Lane Rollins writes: > One of our programmers is having some problems with the HPDATE intrinsics. I can see why. The documentation on Jazz wasn't entirely clear on this, at least not to my reading. [snip] > She is trying to get the day of the > week, but it's returning info= -0022 and subsys = +0529. Anybody have any > ideas? There are a few things that need tweaking here. [snip] > 1.1 01 INDATE-CODE PIC S9(9) VALUE ZEROS. I assume this was really coded as S9(9) COMP, or she would have received a compiler warning. The 'I32V' spec in the documentation (on Jazz) further implies that this needs to be COMP. [snip] > 2.1 01 SPLITYEAR PIC S9(9) VALUE 50. same here. [snip] > 3.7 01 RETURN-SPEC PIC X(8) VALUE SPACES. > 3.8 88 MONDAY VALUE "MON". > 3.9 88 FRIDAY VALUE "FRI". > 4 01 RETURN-LENGTH PIC S9(9) COMP VALUE ZEROS. The RETURN-LENGTH is *both* an input and an output parameter. Going in, it tells HPDATEFORMAT how long RETURN-SPEC is; coming out, it tells how much was actually used. Since it is zero here, the routine thinks there is no room for the result. For ease of maintenance, include $CONTROL POST85 in the beginning of the program, then COMPUTE RETURN-LENGTH = FUNCTION LENGTH( RETURN-SPEC ). as part of the setup code for HPDATEFORMAT. (You need to put it near the call because RETURN-LENGTH is *changed* by the call.) > 266.81 MOVE "DAY " TO FORMAT-SPEC. This is the other major thing that needs tweaking. The documentation says that the format needs to be a "NULL terminated string" (which has meaning for C programmers) but exactly how to indicate this is not clear. One way is to use MOVE SPACES TO FORMAT-SPEC. STRING "DAY" DELIMITED BY SIZE %0 DELIMITED BY SIZE INTO FORMAT-SPEC. where the "percent zero" is the NULL character. With these mods, the code should work. --Glenn Cole Software al dente, Inc. [log in to unmask]