Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm
No new posts change string before sertan string anatol DFSORT/ICETOOL 8 Tue Aug 15, 2017 5:43 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us