I'd probably try to accomplish this by doing a LISTCAT of the GDG Base and then I would pass that into a REXX exec to parse out the GDG versions into a STEM variable. You could then generate the JCL out of the same REXX to run the COBOL program separate times for each GDG version - and you could also probably pass the GDG version to the COBOL program in a file as well? The REXX could also submit the JCL to an INTRDR when it generated it...
-----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of John McKown Sent: Friday, November 18, 2016 10:19 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: How to tell COBOL to read a concatenation of GDGs On Fri, Nov 18, 2016 at 8:54 AM, Lizette Koehler <stars...@mindspring.com> 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://secure-web.cisco.com/1qpVMTWv-wHuKvkXEaLqhFfxZLGr8o_nZpuO5udsLe3SYP0Y6o2yYZ6R7WTvEePM_AZKZiV8huQ8oMr3Xth6Y8g6-FituSCCxcEg6DIopVrzSkxaTAgc-5PZBAnUKxKdyUzuROfo5XIUtg9K9D0ztfqkS9G1JJXPqRXTW6zrCzikPi4g5EehTFX0XC0SiR1dt_7lOefcRCHqqArEg3rsnVl8kSYrL6oGlWGjtqvZ_DhZH21JGlGhX9h--1_kI2xCoy1DEvRm1U8kia1XKHzshMxUJkjzGU_HOiVmIN56Dfr38qgjGwbyAvRiDPzD13x7MtkxDRDrTJU6HjpeC9J0JbKAsAKnh7QufidcX1K3l_EXUNEpsNirjJFTaXW7PLVqCuv6Pjn8X7ArAvN8ntWeqtw/http%3A%2F%2Fxkcd.com%2F1726%2F Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN This email transmission and any accompanying attachments may contain CSX privileged and confidential information intended only for the use of the intended addressee. Any dissemination, distribution, copying or action taken in reliance on the contents of this email by anyone other than the intended recipient is strictly prohibited. If you have received this email in error please immediately delete it and notify sender at the above CSX email address. Sender and CSX accept no liability for any damage caused directly or indirectly by receipt of this email. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN