and create a PF called PRGDS with the fields needed:
1 - 10 Program name
11 - 15 Program Status
16 - 20 Previous Status
With files you usually need 3 maps: Database Files, Printer Files & Display Files. But it works the same way as the Program information DS
Declaring DS is not a problem I can declare it but how to write PF like you told..but how the positions of the fields in the PF gets into the program.
how to declare them in PF.
It's possible, but why would you want to? Much simpler to put the SDS in a /COPY.
But, if you really want to, your PF would need enough filler to to get you to necessary positions:
A R PGMSTS A PGMSTS1 39A TEXT('Filler') A ERRTYPE 3A TEXT('Exception type') A ERRCODE 4A TEXT('Exceptoin number') A PGMSTS47 197A TEXT('Filler') A JOBNAME 10A TEXT('Job name')
Nothing you can do about the specials. You'd have to add them immediately after the E DS
D ESDS EXTNAME(PGMSTSFILE) D PrgStatus *STATUS
A little messy, to say the least.
When you define a PF for use as information feedback (program & files) you must define every field position. As Dale says, it's much easier to define as a /copy, since you can leave gaps in the DS for positions you don't need - and from a personal view, it's easier to see the length and position from the /copy.
Copy source member would probably have a lot more, but along the lines of:
* Program Status DPgmSts SDS D PrgStatus *STATUS D ErrType 3A OVERLAY(PgmSts:40) D ErrCode 4A OVERLAY(PgmSts:43) D JobName 10A OVERLAY(PgmSts:244) D User 10A OVERLAY(PgmSts:254) D JobNumber 6A OVERLAY(PgmSts:264)
1) Job's user is position 254, not 354. Note that Job name, User, and Job number are contiguous 26 bytes, in the order needed by many API's as qualified job name.
2) The specials do have offset equivalents; e.g., *STATUS is 5S0 starting at position 11. (Though I always use *STATUS, and can't say I've ever seen code that does it by position.)