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

Segregation of group of records on record type


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Uday Kumar R

New User


Joined: 07 Nov 2007
Posts: 27
Location: Mumbai

PostPosted: Fri Jul 15, 2011 7:45 am
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: 577
Location: USA

PostPosted: Fri Jul 15, 2011 4:17 pm
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
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: 27
Location: Mumbai

PostPosted: Sun Jul 17, 2011 12:02 pm
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: 27
Location: Mumbai

PostPosted: Sun Jul 17, 2011 12:45 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top