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
 

 

inserting records in between records of another file

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

New User


Joined: 25 Jul 2008
Posts: 5
Location: pune

PostPosted: Tue Nov 25, 2008 3:10 pm    Post subject: inserting records in between records of another file
Reply with quote

Hi All,

I have file1 and file2. i have to copy certain records of file2 in file1. There are same headers of the two files i.e. 1 & 9.

file1 records:---

1aaaaa
2bbbbb
4ddddd
6ccccc
9zzzzzzzz



file2 records:---

1ssssss
3wwww
5rrrrrr
7fffffffff
9andnnnn

now i have to get my oupput file as.:----


output file:-------

1aaaaa
2bbbbb
4ddddd
6ccccc
3wwww
5rrrrrr
7fffffffff
9zzzzzzzz


can you tel me how is it possible?
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Tue Nov 25, 2008 3:16 pm    Post subject: Reply to: inserting records in between records of another fi
Reply with quote

many things are possible, once the rules are well described,
but I am sorry to tell that Yours are not...
Back to top
View user's profile Send private message
sahil mohta

New User


Joined: 25 Jul 2008
Posts: 5
Location: pune

PostPosted: Tue Nov 25, 2008 4:00 pm    Post subject: Reply to: inserting records in between records of another fi
Reply with quote

Here we have to copy the records of file2 in file1 but before that we have to remove first and last record of file2 and also we have to copy before the last record of file1.
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 Nov 25, 2008 11:26 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1   EXEC  PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//SORTIN DD *
1aaaaa
2bbbbb
4ddddd
6ccccc
9zzzzzzzz
1ssssss
3wwww
5rrrrrr
7fffffffff
9andnnnn
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION EQUALS
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'2',SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,1,SS,EQ,C'19'),OVERLAY=(81:1,1,82:8C'0'))
  SORT FIELDS=(81,9,ZD,A)
  SUM FIELDS=NONE
  OUTREC 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 -> 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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 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
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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