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 records if trailer count is not matching

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 17, 2009 2:55 am    Post subject: Filter records if trailer count is not matching
Reply with quote

I have one file in which
Char 1-3 Indicates record type(00-HEADER,05-DETAIL,09-TRAILER)
In header there is sequence number and in trailer there is record count(including corrosponding header and trailer record)
I want to filter this file if record count in trailer is not matching with actual records present for perticular header-trailer block.
For an example.. for below input file
Code:

0000001
05D1
05D2
05D3
05D4
0900006
0000002
05D5
05D6
05D7
0900005
0000003
05D8
05D9
0900005


Output should be
Code:

0000001
05D1
05D2
05D3
05D4
0900006
0000002
05D5
05D6
05D7
0900005


And Error file should contain
Code:

0000003
05D8
05D9
0900005


As for records with header sequence number=00003 actual record count is 00004 but at trailer (09) it is showing 00005, this block is written in error file and not in actual output file.
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Apr 17, 2009 3:39 am    Post subject: Reply to: Filter records if trailer count is not matching
Reply with quote

Sambhaji,

The following DFSORT JCL will give you the desired results.


Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
0000001                                                               
05D1                                                                   
05D2                                                                   
05D3                                                                   
05D4                                                                   
0900006                                                               
0000002                                                               
05D5                                                                   
05D6                                                                   
05D7                                                                   
0900005                                                               
0000003                                                               
05D8                                                                   
05D9                                                                   
0900005                                                               
//OUTPUT   DD SYSOUT=*                                                 
//ERROR    DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(91:1,2)),                           
  IFTHEN=(WHEN=GROUP,BEGIN=(1,2,ZD,EQ,0),PUSH=(81:ID=5,SEQ=5)),       
  IFTHEN=(WHEN=(1,2,ZD,EQ,9),OVERLAY=(91:C'YY',1,80),HIT=NEXT),       
  IFTHEN=(WHEN=(1,2,ZD,EQ,9,AND,86,5,ZD,NE,3,5,ZD),OVERLAY=(91:C'NN'))
  SORT FIELDS=(81,5,CH,A,91,2,CH,A)                                   
                                                                       
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,ZD,EQ,9),PUSH=(91:91,82))       
  OUTFIL FNAMES=OUTPUT,REMOVECC,BUILD=(1,80),                         
  INCLUDE=(91,2,CH,EQ,C'YY',AND,1,2,ZD,NE,9),                         
  SECTIONS=(81,5,TRAILER3=(93,80))                                     
                                                                       
  OUTFIL FNAMES=ERROR,REMOVECC,BUILD=(1,80),                           
  INCLUDE=(91,2,CH,EQ,C'NN',AND,1,2,ZD,NE,9),                         
  SECTIONS=(81,5,TRAILER3=(93,80))                                     
/*
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 17, 2009 4:06 am    Post subject:
Reply with quote

Thanks Kolusu,

It is working exactly as expected. Thanks for the efforts.

I will try to understand logic as I had least worked with WHEN=GROUP and PUSH with ID and SEQ.
If I stuck to any Hedge on this I will PM you
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 17, 2009 4:20 am    Post subject: Reply to: Filter records if trailer count is not matching
Reply with quote

Hello,

Quote:
If I stuck to any Hedge on this I will PM you
It would be better to post any questions back here in your topic.

PMs are for Private dialog, not technical questions. If you need something to be clarified, it is almost positive that someone else does also. By posting the dialog in the topic, more people can benefit from the information icon_smile.gif

Thank you,

d
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 17, 2009 4:33 am    Post subject:
Reply with quote

I agree on that Dick..
I will post it here...
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm

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