Posted: Mon Mar 07, 2005 5:24 pm Post subject: ICETOOL: Expressions in STARTREC & ENDREC ?
Hi,
I need pickup block from my report. For example
ABC, SYSTEMS
REPORT Q
-----------------------------
AEXREC001 1222.22
---------002 0000.00
---------003 0000.50
*****------1222.72
BDATA 001 ...
..
******
AEXREC 001
...
******
Here I need all the records start from AEXREC to endwith next ****** in position 1 to 6. ( I kept the block in red) .. Is it possible do with ICETOOL? Is there anyway i can use expressions in STARTREC & ENDREC ?
Please Advise and appriciate your immediate help ...
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Mar 07, 2005 5:56 pm Post subject:
No, you can't use a logical condition in STARTREC or ENDREC. But you can do what you want with the following DFSORT/ICETOOL job. (I assumed you really had ****** in your input record rather than the ***** you showed.)
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ABC, SYSTEMS
REPORT Q
-----------------------------
AEXREC001 1222.22
---------002 0000.00
---------003 0000.50
******------1222.72
BDATA 001 ...
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//CTL2CNTL DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
// DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
* IN->T1: Generate:
* OUTFIL FNAMES=OUT,STARTREC=n,
* where n is the seqnum of the AEXREC record
* IN->T2: Generate:
* ENDREC=m
* where m is the seqnum of the ****** record
COPY FROM(IN) USING(CTL1)
* IN->OUT: Use the generated control statements.
COPY FROM(IN) USING(CTL2)
/*
//CTL1CNTL DD *
INREC FIELDS=(1,80,81:SEQNUM,8,ZD)
OUTFIL FNAMES=T1,INCLUDE=(1,6,CH,EQ,C'AEXREC'),
OUTREC=(C' OUTFIL FNAMES=OUT,STARTREC=',81,8,C',',80:X)
OUTFIL FNAMES=T2,INCLUDE=(1,6,CH,EQ,C'******'),
OUTREC=(C' ENDREC=',81,8,80:X)
/*
_________________ 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: 1618 Topics: 31 Location: San Jose
Posted: Tue Mar 08, 2005 11:32 am Post subject:
I can't think of a solution for extracting multiple blocks other than to use an E15 exit with the appropriate logic. _________________ 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
Col1 : SEQNUM all the records
Col2 : SEQNUM only the HDR AEXREC
Col3 : SEQNUM only the details records
Col4 : IF CH,EQ,C'AEXREC' THEN Col4=Col2
ELSE Col4=Col1-Col3
Col5 : SEQNUM with RESTART feature on Col4
Frank,
If I code the JCL with
Code:
INCLUDE COND=(81,5,CH,GE,C'00001',AND,81,5,CH,LE,C'00004')
OUTREC FIELDS=(1,80)
I generate the message
Code:
ICE027A 2 END OF FIELD BEYOND MAXIMUM RECORD LENGTH
and I don't understand why because all the records are at least 85 bytes long.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 09, 2005 11:22 am Post subject:
Alain,
Clever. Note that this only works if each group has the same number of records (in this case 4). If group 1 had 4 records and group 2 had 5 records, this wouldn't work. Do you have a trick for the case where the groups can have different numbers of records?
The reason you got the ICE027A with the INCLUDE statement, but NOT with the INCLUDE parameter of the OUTFIL statement is that the INCLUDE statement is processed before the INREC statement, whereas the OUTFIL statement is processed after the INREC statement. So the INCLUDE statement does not see the changes you make with the later INREC statement whereas the OUTFIL statement does see the changes you make with the earlier INREC statement. _________________ 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: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 09, 2005 1:15 pm Post subject:
Alain,
A test of the starting string for the group (AEXREC) and the ending string for the group (******) would be more general. Is the BDATA test (record after end of group) really needed rather than the ****** test (record at end of group) for what you want to do? _________________ 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: 04 May 2003 Posts: 92 Topics: 4 Location: Paris, France
Posted: Wed Mar 09, 2005 1:46 pm Post subject:
Frank,
In the 2nd example given by Hsubra we have duplicates (******---) records, one must be kept, one must be removed. That's why I wanted to use (BDATA). I understand what you mean by a more global solution and that's why I am asking you if you really want me to preserve this 'constraint' or can I bypass it ? I can also try to find something for the both cases.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 09, 2005 2:20 pm Post subject:
Is it just the unmatched ending record (******) that's the problem or any record in the group that has a duplicate outside the group?
I would consider the ideal group solution to be able to just keep the records from the starting string to the ending string for each group, and omit any records outside the groups. I would stipulate that every group has a starting and ending string. I would allow an ending string without a starting string and not consider that to be a group. I would allow any number of records before the first group and after the last group. I would allow duplicates anywhere. So the solution I'm asking about would be able to handle this:
Input
Y
X
Z
...
START
A
B
C
END
C
B
START
C
B
A
END
A
D
END
X
...
Output
START
A
B
C
END
START
C
B
A
END
Of course, I'm sure there are different variations of this in the real world that pose less difficulty for which solutions stipulating more constraints would be useful. _________________ 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
I am back from a small vacation. I saw the nice trick from Alain, when we have a number of records is same in each group. I have tried IFTHEN before my vaction , for me it did not work .. Nice trick Alain. As Frank told, I can not restrict the # of records in the group.
Because of the urgency, I am proposing HLL . But I want to try one more time with ICETOOL.
Is there any way i can reformat my input like this ..
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