On Fri, Nov 18, 2016 at 8:54 AM, Lizette Koehler <[email protected]> wrote:
> List - > > I am a very basic Cobol programmer - openfile/read rec/write rec/close file > > What I need to understand is how to do the following > > I want to either pass a parm or a DD statement that contains a GDG Base > > //S1 EXEC PGM=X,PARM='GDGBASE' > Possible, but not easy. You could call IGGCSI00 to do catalog processing to get the entry names. > > Or > > //S1 EXEC PGM=X > //GDGBASE DD DISP=SHR,DSN=gdgbase,GDGORDER=LIFO Read the GDG backwards > > I prefer the second case with the DD statement > > The program would need to do the following > > 1) Identify the GDG base and what the To/From GDG Numbers are. I cannot > use > Relative numbers as GDGs are always being created, so when the program > starts I > want just the ones created at that time this program begins to execute. > So it > could be G0001V00 to G0010V00 or G0997V00 through G1010V00 etc... > > 2) Once the GDGs are identified, read through them one at a time > So open gdgbase.G0001V00 > Read the entire GDG and write it to a report repository > Once completed, move this GDG number to a backup file in-case there are > issues with the report in the repository > Display a message to a log the GDG was successfully or unsuccessfully > read > Go to the next GDG. > Continue until all are read and added to the Report Repository > > The GDG reports can be from 1 line to millions of lines. No way to know > until > the file is read. > > My question is this > > How can I tell Cobol to read the concatenation of GDGs one at a time? Is > there > anything needed in the FILE SECTION or INPUT OUTPUT Section or FILE > CONTROL? I > have not done this type of coding, so this is new to me. Using Assembler > would > be easier, but this needs to be in Cobol. > Not that I'm aware of. You can do it (I think) in HLASM by using an EOV DCB exit routine. But I don't know of a pure COBOL way to do this. I looked at DECLARATIVES, that didn't see anything. > > Or any other suggestion appreciated. I could do this easily in REXX but > that is > not the design request at this time. > I'm assuming you need a "pure COBOL" solution. None of my tricky UNIX stuff. No faking things out by using TSO via IKJTSOEV. My design would be to use method #1. That is, pass in the GDG base name. I'd use IGGCSI00 to do a catalog lookup to get the associated NONVSAM entries. For each entry I would use BPXWDYN() to allocate it to the appropriate DD name; OPEN, read the DD until EOF, CLOSE, then BPXWDYN() to deallocate the DD; repeat for each GDG element. The most difficult part is setting up the IGGCSI00 call and processing it's output. Before you ask: No, I don't have any code around to do this. If your design excludes using BPXWDYN(), then: "Son, you're on your own" (Blazing Saddles - reverent Johnson to sheriff Bart in the lynching scene) > > Thanks > > > Lizette Koehler > statistics: A precise and logical method for stating a half-truth > inaccurately > > -- Heisenberg may have been here. Unicode: http://xkcd.com/1726/ Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
