Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Filter the recs according to the contents of the next string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Filter the recs according to the contents of the next string
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: 2150
Location: At my coffee table

PostPosted: Tue Feb 12, 2008 9:59 pm    Post subject:
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 Moderator


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

PostPosted: Wed Feb 13, 2008 1:57 am    Post subject:
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    Post subject:
Reply with quote

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

DFSORT Moderator


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

PostPosted: Wed Feb 13, 2008 11:51 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Aug 29, 2008 3:40 am    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Can you write 2 recs on SORTOUT when ... Sysaron DFSORT/ICETOOL 6 Thu Feb 23, 2017 12:07 am
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts For each given key value, how to keep... Div Grad DFSORT/ICETOOL 7 Fri Nov 11, 2016 11:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us