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
 

 

Merging a record of a file with records of other file

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

New User


Joined: 27 Feb 2009
Posts: 12
Location: Bangalore

PostPosted: Tue Mar 30, 2010 5:47 am    Post subject: Merging a record of a file with records of other file
Reply with quote

Hi,

I have a file A which has a record size 8 bytes and it has date in it in ddmmyyy format.

File A
29032010

there is also a file B record size 32756 variable block.

File B
qweqweqw123123123
asdasdas1231231233232
234kjdfjf794579394

output required is
29032010123123123
290320101231231233232
29032010794579394

I have to replace the first 8 bytes of my file B with the date in file A. how do i do using SORT?
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Mar 30, 2010 6:12 am    Post subject:
Reply with quote

Hi,

this might help

Code:
//S1       EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *      input filea                                     
29032010                                                             
/*                                                                   
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)       
//SYSIN    DD    *                                                   
  OPTION COPY                                                         
  INREC BUILD=(C'NDATE,''',1,8,C'''',80:X)                           
/*                                                                   
//S2       EXEC  PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                               
//SYMNOUT  DD SYSOUT=*                                               
//SORTIN   DD DSN=input fileb                                         
//            DISP=SHR                                               
//SORTOUT  DD DSN=output-file                                         
//SYSIN    DD *                                                       
  OPTION COPY                                                         
 OUTREC BUILD=(1,4,NDATE,13)                                         
/*                                                                   



Gerry
Back to top
View user's profile Send private message
technut

New User


Joined: 27 Dec 2007
Posts: 73
Location: India

PostPosted: Tue Mar 30, 2010 11:10 am    Post subject:
Reply with quote

I tried executing this JCL and I am getting the below error,

WER231A OUTREC - ILLEGAL DATA FIELD

Jcl code below..
Code:

//S1       EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                               
29032010                                                     
/*                                                           
//SORTOUT DD DSN=A024277.S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),     
//            DISP=(,CATLG,DELETE)                           
//SYSIN    DD    *                                           
  OPTION COPY                                                 
  INREC BUILD=(C'NDATE,''',1,8,C'''',80:X)                   
/*                                                           
//S2       EXEC  PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SYMNAMES DD DSN=A024277.S1,DISP=SHR                         
//SYMNOUT  DD SYSOUT=*                                       
//SORTIN   DD DSN=A024277.TEST2,                             
//            DISP=SHR                                       
//SORTOUT  DD DSN=A024277.TEST3,DISP=SHR                     
//SYSIN    DD *                                               
  OPTION COPY                                                 
  OUTREC BUILD=(1,4,NDATE,13)
 /*                         


Anything missing here Gerry? or I am missing something!
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Mar 30, 2010 3:02 pm    Post subject:
Reply with quote

Hi,

my job was tested using DFSORT and not SYNCSORT (WER messages) as posted in DFSORT/ICETOOL forum.

When you get an error, you need to show the entire job output.

Try allocating the output file with correct DCB attributes, they should be same as the input file.

Better still, create the file as in S1 step, do not pre-allocate it.


Gerry
Back to top
View user's profile Send private message
technut

New User


Joined: 27 Dec 2007
Posts: 73
Location: India

PostPosted: Tue Mar 30, 2010 3:43 pm    Post subject:
Reply with quote

All the 3 datasets are alike w.r.t attributes.. there is no problem there. Here is the full output of the error messages,

Code:

SYNCSORT FOR Z/OS  1.3.2.1N    U.S. PATENTS: 4210961, 5117495   (C) 2007 SYNC
                                                      z/OS   1.9.0           
SYNCSORT LICENSED FOR CPU SERIAL NUMBER D7B9E, MODEL 2097 710             LIC
SYSIN :                                                                     
  OPTION COPY                                                               
 OUTREC BUILD=(1,4,NDATE,13)                                                 
DATA DICTIONARY SYMBOLS SUBSTITUTED :                                       
OPTION COPY                                                                 
OUTREC BUILD=(1,4,C'29032010',13)                                           
WER276B  SYSDIAG= 981069, 2608684, 2608684, 1892017                         
WER164B  8,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,           
WER164B     0 BYTES RESERVE REQUESTED, 1,012K BYTES USED                     
WER146B  12K BYTES OF EMERGENCY SPACE ALLOCATED                             
WER108I  SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE= 27920               
WER231A  OUTREC - ILLEGAL DATA FIELD                                         
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                               
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Mar 30, 2010 3:59 pm    Post subject:
Reply with quote

Hi,

what happened to this
Quote:
there is also a file B record size 32756 variable block.


Now input file is
Code:
WER108I  SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE= 27920               


Which one is correct ?

If the second is correct then use
Code:
  OPTION COPY                 
  OUTREC BUILD=(NDATE,9,72)   


Gerry
Back to top
View user's profile Send private message
technut

New User


Joined: 27 Dec 2007
Posts: 73
Location: India

PostPosted: Tue Mar 30, 2010 4:08 pm    Post subject:
Reply with quote

Hi Gerry,

The question was initially asked by another user. Not me!

I was simply trying out the jcl code posted by you as I could not understand the OUTREC options used there. All my files are FB=80.

Now I understand that in OUTREC=(1,4..) was used to accomodate the first 4 bytes of VB right..?

Now its working fine.. and I got the OUTREC logic that was employed by you. Thanks for your time.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Mar 30, 2010 4:17 pm    Post subject:
Reply with quote

Hi Technut,

I didn't realise I was dealing with a different user, I apologise.

Quote:
Now I understand that in OUTREC=(1,4..) was used to accomodate the first 4 bytes of VB right..?
and yes you are correct.

Gerry
Back to top
View user's profile Send private message
technut

New User


Joined: 27 Dec 2007
Posts: 73
Location: India

PostPosted: Tue Mar 30, 2010 5:02 pm    Post subject:
Reply with quote

I guessed so! No problem at all. Got a chance to learn something new..

Thanks for the clarification.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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