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
 

 

Copying Data from 2 files into one file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Thu Feb 08, 2007 8:52 pm    Post subject: Copying Data from 2 files into one file
Reply with quote

hi

i need to copy data from 2 files of various lengths, into one file.
say one file has data of length 19 and the second one has length 2.
i need to copy both of these into one output file side by side.
i.e if the first file contains time and second file contains count, then

the output should be

TIME= (value from first file) COUNT=(value from second file)

where TIME and COUNT are strings included in the output file manually.
can some tell me whether this could be done using SORT pgm?
pls provide the syntax here.
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 Feb 08, 2007 9:40 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/19)
//IN2 DD DSN=...  input file2 (FB/2)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/33)
//TOOLIN   DD    *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(34,8,ZD) -
  WITH(32,2) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(C'TIME=',6:1,19,26:C'COUNT=',34:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
  INREC BUILD=(32:1,2,34:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,33)
/*


For more information on this type of "join", see the "Join fields from two files record-by-record" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Thu Feb 08, 2007 10:11 pm    Post subject: Re: Copying Data from 2 files into one file
Reply with quote

hi frank..

thnks for the reply..
i tried to run your code, and it gives me this error.
can you pls help me out with this?


CTL1CNTL :
INREC BUILD=(C'TIME=',6:1,19,26:C'COUNT=',34:SEQNUM,8,ZD)
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=SORTIN1,SORTOUT=TEMP,SORTDD=CTL
COPY
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER276B SYSDIAG= 46453, 437238, 437238, 1598304
WER164B 8,960K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 3,138,144 BYTES USED
WER146B 4K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN1 : RECFM=FB ; LRECL= 34; BLKSIZE= 27982
WER257I INREC RECORD LENGTH = 41
WER238I POTENTIALLY INEFFICIENT USE OF INREC
WER110I TEMP : RECFM=FB ; LRECL= 41; BLKSIZE= 27962
WER416B SORTIN1 : EXCP'S=1,UNIT=3390,DEV=8D48,CHP=(A1A5A9ADC1C5C9CD,1),VOL=G
WER416B TEMP : EXCP'S=1,UNIT=3390,DEV=8B74,CHP=(9195999DB1B5B9BD,2),VOL=G
WER416B TOTAL OF 2 EXCP'S ISSUED FOR COPYING
WER054I RCD IN 1, OUT 1
WER169I RELEASE 1.2 BATCH 0427 TPF LEVEL 1.0



ajai
Back to top
View user's profile Send private message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Thu Feb 08, 2007 10:42 pm    Post subject: Re: Copying Data from 2 files into one file
Reply with quote

HI FRANK

IS IT POSSIBLE TO OBTAIN TIMESTAMP IN THE SORT ITSELF, BECAUSE THIS WILL SOLVE MY PROBLEM EASLIY. RIGHT NOW I M ABLE TO GET THE CURRENT DATE FROM THE SORT ITSELF BY THIS SYNTAX,

SORT FIELDS=COPY
OUTREC FIELDS=(C'START TIME= ',DATE,C' NUM REC IN FILE= ',1,16)


I WANT TO KNOW WHETHER ANY SUCH COMMAND IS PRESENT TO RETRIEVE TIME ALSO IN THIS WAY. THEN THER WILL BE NO NEED FOR ME TO COPY DATA FROM 2 FILES.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Feb 08, 2007 11:50 pm    Post subject:
Reply with quote

Ajai,

Good news, Bad news......You have Syncsort........Synsort does have date and time available in outrec (trailers?)..........In the listing given, it seems that it ran but with little or no input? No major errors pointing to the control statements......
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: Fri Feb 09, 2007 2:04 am    Post subject:
Reply with quote

Ajai,

You can use TIME1 (or variations) to get the current time.

Note: I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Feb 09, 2007 3:09 am    Post subject:
Reply with quote

Hi Ajai,

How did these 2 files get created?

What do you want to happen if ever one file has a different number of records than the other?
Back to top
View user's profile Send private message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Fri Feb 09, 2007 9:49 am    Post subject: Re: Copying Data from 2 files into one file
Reply with quote

hi guys

thanks for all the help. i was able to solve it finally using ICETOOL pgm itself. the way frank suggested icon_smile.gif . i get these 2 files from previous steps of the jcl. these 2 files always have one record only.. one containing timestamp and another oen the record count. If some one needs the syntax pls let me know.
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 Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 1 Thu Jul 27, 2017 9:16 pm
No new posts Paasing symbolic parameter to instrea... Anirudh Anand JCL & VSAM 1 Thu Jul 27, 2017 1:22 pm
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 3 Wed Jul 26, 2017 9:11 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm


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