IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Merging a record of a file with records of other file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1702
Location: Australia

PostPosted: Tue Mar 30, 2010 6:12 am
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
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: 1702
Location: Australia

PostPosted: Tue Mar 30, 2010 3:02 pm
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
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: 1702
Location: Australia

PostPosted: Tue Mar 30, 2010 3:59 pm
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
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: 1702
Location: Australia

PostPosted: Tue Mar 30, 2010 4:17 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
Search our Forums:

Back to Top