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
 

 

Splitting a file(record number varis) into different files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Rajendra Kumar

New User


Joined: 26 Jun 2009
Posts: 13
Location: Hyderabad

PostPosted: Tue Aug 04, 2009 6:46 pm    Post subject: Splitting a file(record number varis) into different files
Reply with quote

Hi,

I am having the data in the file as

HL1.......................ABC.........XYZ
Record-1
Record-2
Record-3
HL1.......................DEF...........PQR
Record-4
Record-5
HL1......................GHI.........TUV
Record-6
Record-7
Record-8
Record-9


The Header Record always starts with HL1,I require the first header record and the below 3 records(basically upto next Header record) needs to be written to a new file and the second header record and the next 2 records(record-4,5) needs to be written into another file and finally the 3rd one also in the same way

The records after the Header record will be varying,the file is of fixed length....we can take that as 80.

I tried in many ways but I was not able to get as the record number is varying.

Can anyone please help me out doing this using sort.

Thanks,
Rajendra
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: Tue Aug 04, 2009 9:04 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//OUT1 DD DSN=...  output file1
//OUT2 DD DSN=...  output file2
//OUT3 DD DSN=...  output file3
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HL1'),
    PUSH=(81:ID=1))
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
  OUTFIL FNAMES=OUT3,INCLUDE=(81,1,CH,EQ,C'3'),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
Rajendra Kumar

New User


Joined: 26 Jun 2009
Posts: 13
Location: Hyderabad

PostPosted: Wed Aug 05, 2009 1:18 pm    Post subject:
Reply with quote

Hi Frank,

I am getting the error as "-INREC STATEMENT : SYNTAX ERROR".

I am using SYNCSORT and not DFSORT,not sure if anything needs to be changed other than "OPTION COPY" to "SORT FIELDS=COPY".

Thanks!
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Wed Aug 05, 2009 2:23 pm    Post subject:
Reply with quote

Rajendra Kumar,

The job posted above would have worked fine for you if you had the latest release of SyncSort - SyncSort for z/OS 1.3.2 which supports the WHEN=GROUP function.
Since it's throwing syntax error, I assume you are running an older version of SyncSort. Here's a SyncSort job which should work for SyncSort 1.2 or above.
Code:
//STEP1  EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN= Input file (FB/80)                               
//OUT1     DD DSN= Output file-1 (FB/80)                             
//OUT2     DD DSN= Output file-2 (FB/80)                             
//OUT3     DD DSN= Output file-3 (FB/80)                             
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),                 
        IFTHEN=(WHEN=(1,3,CH,EQ,C'HL1'),                             
        OVERLAY=(81:SEQNUM,8,ZD)),                                   
        IFTHEN=(WHEN=NONE,                                           
        OVERLAY=(89:SEQNUM,8,ZD,81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)             
  OUTFIL FNAMES=OUT2,INCLUDE=(81,8,ZD,EQ,2),BUILD=(1,80)             
  OUTFIL FNAMES=OUT3,INCLUDE=(81,8,ZD,EQ,3),BUILD=(1,80)
Back to top
View user's profile Send private message
Rajendra Kumar

New User


Joined: 26 Jun 2009
Posts: 13
Location: Hyderabad

PostPosted: Wed Aug 05, 2009 3:25 pm    Post subject:
Reply with quote

Hi,

I am getting the error as

CONVERT FEATURE CANNOT BE USED WITH OVERLAY OR IFTHEN
SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


I am using SYNCSORT FOR Z/OS 1.2.1 version.

Also,I am not sure whether the second overlay(basically for sub records) is correct or not.

IFTHEN=(WHEN=NONE,
OVERLAY=(89:SEQNUM,8,ZD,81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))

I think this needs to be changed.

Any help is really appreciated.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Wed Aug 05, 2009 3:32 pm    Post subject:
Reply with quote

Rajendra Kumar,

My shop has recently been upgraded to SyncSort 1.3.2. And above code works fine for me. But I have nt used any new functions here.

Can you post the entire SYSOUT messages here?.
Back to top
View user's profile Send private message
Rajendra Kumar

New User


Joined: 26 Jun 2009
Posts: 13
Location: Hyderabad

PostPosted: Wed Aug 05, 2009 3:45 pm    Post subject:
Reply with quote

Sorry Arun....The code is working fine & Thanks a lot for the HELP.

In the Forum I had mentioned the file length as 80 but actually it is of 400 and so in my real time environment there was a small mistake from my side(numbers in SYSIN card)...I had changed the same and everything is fine...


Once again Thanks for the Information.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Thu Aug 06, 2009 4:47 am    Post subject:
Reply with quote

You're welcome. icon_smile.gif Anyways good to hear that you adapted the job as per your real file attributes.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm


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