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

HOW TO SPLIT A FILE INTO TWO BASED ON PARTICULAR STRING


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

New User


Joined: 10 Mar 2005
Posts: 41
Location: United States Of America

PostPosted: Thu Jul 06, 2006 11:17 am
Reply with quote

Hi Friends,

I have a small query in JCL.

File1:

000000000000
222222222222
444444444444
***********
888888888888
999999999999
555555555555


I want to split this file1 into two files say fileA & fileB based on record which contains " ********** "

Output

File A
------
000000000000
222222222222
444444444444

File B
-------
888888888888
999999999999
555555555555


*'s Comes only once in a file and can be in any record. I can do this using a simple program but i need to do this using JCL.

Can anyone know the JCL Utilite to make this done.

Thanks
Sameer
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jul 06, 2006 9:10 pm
Reply with quote

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes. For more information on the IFTHEN group technique used in this job, see:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmtrck.html#d01

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//OUT1 DD DSN=...  output file1 (FB/80)
//OUT2 DD DSN=...  output file2 (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'***'),
                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,+0),
    BUILD=(1,80)
  OUTFIL FNAMES=OUT2,
    INCLUDE=(81,8,ZD,EQ,+1,AND,1,3,CH,NE,C'***'),
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
sameer

New User


Joined: 10 Mar 2005
Posts: 41
Location: United States Of America

PostPosted: Fri Jul 07, 2006 5:17 pm
Reply with quote

Thanks alot Frank Yaeger. The worked well.
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 Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top