Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 24, 2008 10:47 am Post subject:
You could use SUBSET for this if the number of DCLGEN lines was always the same. But I suspect that's not the case so I'd suggest using DFSORT's new WHEN=GROUP function instead. Assuming you want the output to contain all of the records starting with the '01' record, you could use this DFSORT job:
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 24, 2008 11:54 am Post subject:
Yes, you do not have the PTF installed. Ask your System Programmer to install it (it's free). _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Dec 24, 2008 12:08 pm Post subject:
pete,
You need to consider the block starting with "cobol declaration for table" as the beginning and end with "the number of columns described" as a single group to get only the DCLGEN blocks as a cobol program may have several 01 level defined items apart from DCLGEN. Since you don't have the Latest PTF try this DFSORT/ICETOOL JCL which will give you the desired results.
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
******************************************************************
* DCLGEN TABLE(MYTABSE)
* LIBRARY(TESTY.R15.VA11111C(DTMYTABS)) *
* LANGUAGE(COBOL) *
* QUOTE *
* ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS *
******************************************************************
EXEC SQL DECLARE MYTABSE_TABLE TABLE
( COMPANY_CODE CHAR(3) NOT NULL,
MASTER_ID CHAR(15) NOT NULL,
MYTABS_AREA VARCHAR(3672)
) END-EXEC.
******************************************************************
* COBOL DECLARATION FOR TABLE VACYONRA.MYTABSE *
******************************************************************
01 MYTABSE-TABLE.
10 COMPANY-CODE PIC X(3).
10 MASTER-ID PIC X(15).
10 MYTABS-AREA.
49 MYTABS-AREA-LEN PIC S9(4) USAGE COMP.
49 MYTABS-AREA-TXT PIC X(3672).
******************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 4 *
******************************************************************
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(81,8,CH) KEEPNODUPS KEEPBASE -
WITHALL WITH(01,80) USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(9,27,CH,EQ,C'COBOL DECLARATION FOR TABLE',OR,
9,31,CH,EQ,C'THE NUMBER OF COLUMNS DESCRIBED'),
OVERLAY=(81:SEQNUM,8,ZD,9,31)),
IFTHEN=(WHEN=NONE,OVERLAY=(89:SEQNUM,8,ZD,
81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
OUTFIL FNAMES=OUT,BUILD=(1,80),
INCLUDE=(89,27,CH,EQ,C'COBOL DECLARATION FOR TABLE')
/*
if you had the latest PTF it would be have much easier like this
Code:
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
******************************************************************
* DCLGEN TABLE(MYTABSE)
* LIBRARY(TESTY.R15.VA11111C(DTMYTABS)) *
* LANGUAGE(COBOL) *
* QUOTE *
* ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS *
******************************************************************
EXEC SQL DECLARE MYTABSE_TABLE TABLE
( COMPANY_CODE CHAR(3) NOT NULL,
MASTER_ID CHAR(15) NOT NULL,
MYTABS_AREA VARCHAR(3672)
) END-EXEC.
******************************************************************
* COBOL DECLARATION FOR TABLE VACYONRA.MYTABSE *
******************************************************************
01 MYTABSE-TABLE.
10 COMPANY-CODE PIC X(3).
10 MASTER-ID PIC X(15).
10 MYTABS-AREA.
49 MYTABS-AREA-LEN PIC S9(4) USAGE COMP.
49 MYTABS-AREA-TXT PIC X(3672).
******************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 4 *
******************************************************************
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(9,27,CH,EQ,C'COBOL DECLARATION FOR TABLE'),
END=(9,31,CH,EQ,C'THE NUMBER OF COLUMNS DESCRIBED'),
PUSH=(81:ID=8,SEQ=8))
OUTFIL INCLUDE=(81,8,ZD,GT,0,AND,89,8,ZD,GT,2),BUILD=(1,80)
/*
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 24, 2008 3:41 pm Post subject:
As I said, "Assuming you want the output to contain all of the records starting with the '01' record, you could use this DFSORT job". If there's more to it then that, I wish the OP had provided a better description of what was wanted or indicated my assumption was incorrect. I don't know DB2 or COBOL, so I was just going by the description given.
Kolusu or Pete,
It would help people reading this thread later if you would show a more complete input example that requires the more involved solution. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 22 Topics: 9 Location: www.state.ct.us
Posted: Tue Dec 30, 2008 9:12 pm Post subject:
Frank/Kolusu:
Sorry, I was away for a few days. My company is not putting any maintenance on our system for a few weeks. Last week I wrote a CLIST to build my copybooks. I will use a provided SORT solution to maintain my new jobs. Thank you for the help. _________________ Regards,
Pete.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum