IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Filter the recs according to the contents of the next string


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Andrew Shinkarev

New User


Joined: 10 Jan 2008
Posts: 22
Location: Belarus

PostPosted: Tue Feb 12, 2008 9:51 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Feb 12, 2008 9:59 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Feb 13, 2008 1:57 am
Reply with quote

Can the output be FB or does it have to be VBA?
Back to top
View user's profile Send private message
Andrew Shinkarev

New User


Joined: 10 Jan 2008
Posts: 22
Location: Belarus

PostPosted: Wed Feb 13, 2008 3:07 pm
Reply with quote

FB is good
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Feb 13, 2008 11:51 pm
Reply with quote

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
View user's profile Send private message
Andrew Shinkarev

New User


Joined: 10 Jan 2008
Posts: 22
Location: Belarus

PostPosted: Thu Feb 14, 2008 10:31 pm
Reply with quote

Thank you very much, Frank. It helped finally to understand IFTHEN usage.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Aug 29, 2008 3:40 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts Help to Filter File Manager Copybook ... DFSORT/ICETOOL 14
Search our Forums:

Back to Top