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
 
Segregation of group of records on record type

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

New User


Joined: 07 Nov 2007
Posts: 25
Location: Mumbai

PostPosted: Fri Jul 15, 2011 7:45 am    Post subject: Segregation of group of records on record type
Reply with quote

Hi ,

I have a file of 100 charcters length with 3 types of records A,B,C (which is called a set) with header and trailer. The records were in the the order HDR,A,B,C,TRL. It doesn't always all consist 3 records types for a particular set. For every C record, A & B are must. For Every B record, A record is must. Single record type A doesn't exists.

Now the requirement is i have a field coloum in 10th -13th position of record type B, (suppose say country name). Based on the country name i need segregate the information all the A,B,C of the corresponding records into 2 files.The country name in the B records is always same if it is more than one record.

File:

HDR2011071500000120
A1111111120110715THISISLOCALTRANSACTION
B00001200IND0001200
C00001200ABACTION
A222222220110715THISISLOCALTRANSACTION
B00001100USA0001200
C00001102ABACTION
C00001202ACACTION
A333333320110715THISISLOCALTRANSACTION
B00001200GER0001000
B00001300GER0001000
C00001640GEACTION
A444444420110715THISISLOCALTRANSACTION
B00001010IND0001200
B00001250IND0001200
C00001011ABACTION
C00001251ACACTION
A555555520110715THISISLOCALTRANSACTION
B00001200POL0031200
B00001302POL0031200
TRLXXX19RECORDS


I would like to keep all USA,POL records in one file and rest in another file
along with count of records.

FIRST FILE:

HDR2011071500000120
A2222222220110715THISISLOCALTRANSACTION
B00001100USA0001200
C00001102ABACTION
C00001202ACACTION
A5555555520110715THISISLOCALTRANSACTION
B00001200POL0031200
B00001302POL0031200
TRLXXX07RECORDS

2ND FILE:

HDR2011071500000120
A1111111120110715THISISLOCALTRANSACTION
B00001200IND0001200
C00001200ABACTION
A3333333320110715THISISLOCALTRANSACTION
B00001200GER0001000
B00001300GER0001000
C00001640GEACTION
A4444444420110715THISISLOCALTRANSACTION
B00001010IND0001200
B00001250IND0001200
C00001011ABACTION
C00001251ACACTION
TRLXXX12RECORDS

Please help how can i perform this using sort.

Regards,
Uday
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Jul 15, 2011 4:17 pm    Post subject:
Reply with quote

Uday,
Please provide RECFM for the input file?is it FB?

How is header record constructed? Looking at the sample data, it seems it has System date after HDR and some number (00000120 in this case). What is this number? Is it always same?

Looks like your trailer record has count which needs to be updated with the new count after splitting the files? Is that correct?

Your DFSort function level?

Thanks,
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Jul 15, 2011 10:47 pm    Post subject:
Reply with quote

Uday Kumar R,

Use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD DSN=Your input FB 100 BYTE file,DISP=SHR
//USAPOL   DD SYSOUT=*                                           
//REST     DD SYSOUT=*                                           
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(204:C'1')),                   
  IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'A'),RECORDS=2,           
  PUSH=(101:1,100)),                                             
  IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'B'),PUSH=(201:10,3)),     
  IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),OVERLAY=(201:3X)),               
  IFTHEN=(WHEN=(101,1,CH,EQ,C'A'),OVERLAY=(204:C'2')),           
  IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),OVERLAY=(204:C'1'))               
                                                                 
  OUTFIL FNAMES=USAPOL,IFOUTLEN=100,                             
  INCLUDE=(201,3,SS,EQ,C'USA,POL',OR,1,3,SS,EQ,C'HDR,TRL'),       
  IFTHEN=(WHEN=(1,1,CH,EQ,C'B',AND,101,1,CH,EQ,C'A'),             
  BUILD=(101,100,/,1,100)),                                       
  IFTRAIL=(HD=YES,TRLID=(1,3,CH,EQ,C'TRL'),                       
  TRLUPD=(7:TOT=(204,1,ZD,M11,LENGTH=2)))                         
                                                                 
  OUTFIL FNAMES=REST,IFOUTLEN=100,                               
  OMIT=(201,3,SS,EQ,C'USA,POL',OR,1,1,CH,EQ,C'A'),               
  IFTHEN=(WHEN=(1,1,CH,EQ,C'B',AND,101,1,CH,EQ,C'A'),             
  BUILD=(101,100,/,1,100)),                                       
  IFTRAIL=(HD=YES,TRLID=(1,3,CH,EQ,C'TRL'),                       
  TRLUPD=(7:TOT=(204,1,ZD,M11,LENGTH=2)))                         
//*
Back to top
View user's profile Send private message
Uday Kumar R

New User


Joined: 07 Nov 2007
Posts: 25
Location: Mumbai

PostPosted: Sun Jul 17, 2011 12:02 pm    Post subject:
Reply with quote

Hi SKolusu,

I got the required output. Basically thanks ful to your logic and the command BUILD=(101,100,/,1,100)) -- This command make me very helpful. i read the Dfsort getting started book and Dfsort tricks, but not sure i have missed such a good command. thanks you alot.


Hi Sql,
The length is 100 & RB. Yes the number changes, basically it is a batch header number, increments whenever the batch runs. Not much expertise level in DFsort. Reading sort books and going thru this forum i am trying to solve problems myself. Thank you.

Thank You,
Uday
Back to top
View user's profile Send private message
Uday Kumar R

New User


Joined: 07 Nov 2007
Posts: 25
Location: Mumbai

PostPosted: Sun Jul 17, 2011 12:45 pm    Post subject:
Reply with quote

Hi Sql,

Sorry. I wrongly understand your question.

The Dfsort fucntion level at my project is
z/OS DFSORT V1R5 PTF UK51706 showing ICE201I G RECORD TYPE..

Thanks
Uday
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
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 Setting Font Type for XMIT satish.ms10 All Other Mainframe Topics 3 Fri Sep 15, 2017 10:01 pm

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