Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us