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

COPY from A file till particular record is found


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

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Wed Apr 25, 2007 9:42 pm
Reply with quote

Hi ALL,
I have a flat file with large no of recs. I want to copy these recs to 2 other files such that first file contains recs till a perticular record and other file contains recs after that perticular rec.
Now, this perticular rec needs to be searched as we don't know its location but we have a search key
How to accomplish this ?
--Parag
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: Wed Apr 25, 2007 10:09 pm
Reply with quote

What is the RECFM and LRECL of the input file?

What is the value and format of the search key?

Does the search key start at a particular position in the record? If so, what is that position? Or can the search key be anywhere in the record?
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Wed Apr 25, 2007 11:11 pm
Reply with quote

Hi Frank,
Thanks for your reply
The RECFM=FB and LRECL=200
Search key has a fixed position ie. starting 5 bytes
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 Apr 26, 2007 12:32 am
Reply with quote

Is the search key a character value? What's the length? Is it always the same value or does it change from run to run? Please give an example of the search key value.

Do you want the record with the search key in the first output file or in the second output file?
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Thu Apr 26, 2007 2:54 pm
Reply with quote

Hi Frank,
Here is an example of my Input and Output files

Input File
abcd111122223333 ---- normal rec
abcd111122223333 ---- normal rec
abcd111122223333 ---- normal rec
abcd111122223333 ---- normal rec
DATE=03012007 ----------------------------Specical Rec (Date)
efgh111122223333 ---- normal rec
efgh111122223333 ---- normal rec
efgh111122223333 ---- normal rec
efgh111122223333 ---- normal rec

OUTPUT File 1
abcd111122223333
abcd111122223333
abcd111122223333
abcd111122223333

OUTPUT File 2

DATE=03012007
efgh111122223333
efgh111122223333
efgh111122223333
efgh111122223333

I don't want exact SORT steps. just give me idea of how to do that ?
--Parag
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 Apr 26, 2007 9:15 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 this group technique, see the "Include or omit groups of records" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

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,5,CH,EQ,C'DATE='),
                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,5,CH,NE,C'DATE='),
    BUILD=(1,80)
/*
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top