View previous topic :: View next topic
Author
Message
Andrew Shinkarev New User Joined: 10 Jan 2008Posts: 22 Location: Belarus
Hi all
There is a file (VBA/132) containing a kind of execution log:
Code:
HEADER11
HEADER12
................
OLD: aOLDKEY1xxxxxxxxxx
NEW: DELETED
OLD: aOLDKEY2xxxxxxxx
NEW: aNEWKEY2xxxxxxxxxxxx
OLD: aOLDKEY3xxxxxxxx
NEW: DELETED
OLD: aOLDKEY4xxxxxxxxx
NEW: aNEWKEY4xxxxxxxxxxx
OLD: aOLDKEY3xxxxxxxx
NEW: DELETED
................
TRAILER11
TRAILER12
The key starts at pos=7 and length=12. There are possible duplicates (like OLDKEY3 above)
The requirement is to get the list of all "deleted" keys with the count of them made in the next manner(according to the contents of example):
Code:
OLDKEY1 1
OLDKEY3 2
Total lines: 2
Total occurences: 3
I would greatly appreciate any advice
Back to top
CICS Guy Senior Member Joined: 18 Jul 2007Posts: 2146 Location: At my coffee table
Wouldn't using of the SPLICE command allow you to join the OLD and NEW into one record? Once in a single record, the selective counts should be easy.....
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Can the output be FB or does it have to be VBA?
Back to top
Andrew Shinkarev New User Joined: 10 Jan 2008Posts: 22 Location: Belarus
FB is good
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VBA/132)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/30)
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(T1) TO(T2) ON(31,8,ZD) WITH(31,8) USING(CTL2)
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
OPTION VLSCMP
INCLUDE COND=(6,4,CH,EQ,C'OLD:',OR,6,12,CH,EQ,C'NEW: DELETED')
OUTFIL FNAMES=T1,VTOF,BUILD=(6,18)
/*
//CTL2CNTL DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(31:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'OLD'),
OVERLAY=(31:SEQNUM,8,ZD)),
IFTHEN=(WHEN=NONE,
OVERLAY=(39:SEQNUM,8,ZD,
31:31,8,ZD,SUB,39,8,ZD,TO=ZD,LENGTH=8))
OUTFIL FNAMES=T2,BUILD=(7,12,C'00001',C'00001')
/*
//CTL3CNTL DD *
SORT FIELDS=(1,12,CH,A)
OPTION ZDPRINT
SUM FIELDS=(13,5,ZD)
OUTFIL FNAMES=OUT,REMOVECC,
BUILD=(1,12,13,5,ZD,EDIT=(IIIIT),30:X),
TRAILER1=('Total lines: ',TOT=(18,5,ZD,EDIT=(IIIIT)),/,
'Total occurences: ',TOT=(13,5,ZD,EDIT=(IIIIT)))
/*
Back to top
Andrew Shinkarev New User Joined: 10 Jan 2008Posts: 22 Location: Belarus
Thank you very much, Frank. It helped finally to understand IFTHEN usage.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You can do this more easily and efficiently using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VBA/132)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/30)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
OPTION VLSCMP
INCLUDE COND=(6,4,CH,EQ,C'OLD:',OR,6,12,CH,EQ,C'NEW: DELETED')
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(6,12,CH,NE,C'NEW: DELETED'),PUSH=(11:12,12)),
IFTHEN=(WHEN=INIT,OVERLAY=(23:C'00001'))
OUTFIL FNAMES=T1,INCLUDE=(6,4,CH,EQ,C'NEW:'),VTOF,
BUILD=(11,17,30:X)
/*
//CTL2CNTL DD *
SORT FIELDS=(1,12,CH,A)
SUM FIELDS=(13,5,ZD)
OUTFIL FNAMES=OUT,REMOVECC,
BUILD=(1,12,13,5,ZD,EDIT=(IIIIT),30:X),
TRAILER1=('Total lines: ',COUNT=(EDIT=(IIIIT)),/,
'Total occurences: ',TOT=(13,5,ZD,EDIT=(IIIIT)))
/*
For complete details on the new WHEN=GROUP function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links
Back to top
Please enable JavaScript!