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
 

 

COPY from A file till particular record is found

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: COPY from A file till particular record is found
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 Moderator


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

PostPosted: Wed Apr 25, 2007 10:09 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Apr 26, 2007 12:32 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Apr 26, 2007 9:15 pm    Post subject:
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:

http://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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 3 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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