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
 

 

Overlay part of a record without affecting the entire record
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sunil.sunny

New User


Joined: 25 Feb 2012
Posts: 5
Location: US

PostPosted: Sat Feb 25, 2012 10:23 pm    Post subject: Overlay part of a record without affecting the entire record
Reply with quote

I have two files with the below description:
i) Sequential file with LRECL as 5 bytes and FB format
ii) Sequential file with LRECL as 15 bytes and FB format

My requirement is to overlay last 5 bytes of the second file with the contents from the first file and making sure that the first 10 bytes of the second file are not affected.

I have tried FILEAID option but I am not able to retain the first 10 bytes.

Note: I want this to be handled in a JCL step.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Sat Feb 25, 2012 10:38 pm    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

search the forum for joinkeys

You will find quite a few topics dealing with file matching and building output records with fields from both input files

but ( fastest )
if You are using DFSORT ( ICE messages ) You might want to go to
ftp://ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
and look at Join fields from two files record-by-record

the solutions posted might work also for SYNCSORT ( WER messages )
Back to top
View user's profile Send private message
sunil.sunny

New User


Joined: 25 Feb 2012
Posts: 5
Location: US

PostPosted: Sun Feb 26, 2012 7:42 am    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

I got a JCL from the link mentioned by you and have customized the JCL mentioned below for my requirement. But it gives a syntax error at the JOINKEYS step. I am not able to figure out the problem.

IN1 dataset - LRECL - 10
IN2 dataset - LRECL - 5

Please note that I have only record in both of the files.

Code:
//JOINS    EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//IN1      DD DSN=TEMP1.DATASET,DISP=SHR   
//IN2      DD DSN=TEMP2.DATASET,DISP=SHR     
//SORTOUT  DD DSN=FINAL.DATASET,DISP=SHR       
//SYSIN    SUBSYS=(CCSS,                                 
// ' JOINKEYS F1=IN1,FIELDS=(11,8,A),SORTED,NOSEQCK  ',
// ' JOINKEYS F2=IN2,FIELDS=(6,8,A),SORTED,NOSEQCK   ',
// ' REFORMAT FIELDS=(F1:1,10,F2:1,5)                            ',   
// ' OPTION COPY                                                            ')                                         
//JNF1CNTL DD SUBSYS=(CCSS,                                 
// ' INREC OVERLAY=(11:SEQNUM,8,BI)                 ')                                                         
//JNF2CNTL DD SUBSYS=(CCSS,                                 
// ' INREC OVERLAY=(6:SEQNUM,8,BI)                  ')
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Feb 26, 2012 7:55 am    Post subject:
Reply with quote

well what errors did you receive?

and what are all the single quotes?
Back to top
View user's profile Send private message
sunil.sunny

New User


Joined: 25 Feb 2012
Posts: 5
Location: US

PostPosted: Sun Feb 26, 2012 8:18 am    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

I am getting the below syntax error:

Code:
SYSIN:                               
  JOINKEYS F1=IN1,FIELDS=(11,8,A),SORTED,NOSEQCK
                 *
  JOINKEYS F2=IN2,FIELDS=(6,8,A),SORTED,NOSEQCK 
                 *
 REFORMAT FIELDS=(F1:1,10,F2:1,5)             
 OPTION COPY                               
 JOINKEYS STATEMENT: SYNTAX ERROR
 JOINKEYS STATEMENT: SYNTAX ERROR
 SYNCSMF CALLED BY SYNCSORT; RC=0000

I think the problem is due to syncsort.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Sun Feb 26, 2012 1:20 pm    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

It is not due to Syncsort, it is due to you using the wrong syntax.

Have a search in this forum for JOINKEYS. Note the difference in syntax for Syncsort. Apply change. Run.

Please use the Code tags when you want to preserve spacing in your posts.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Sun Feb 26, 2012 1:29 pm    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

Quote:
I got a JCL from the link mentioned by you and have customized the JCL mentioned below for my requirement.

it' s pity that You did not notice my remark
Quote:
if You are using DFSORT ( ICE messages ) You might want to go to


since You are using SYNCSORT it is more than normal that it did not work...
You will have to resort searching the JCL forum

also it is usual around here for code snippets and sysout data to use the code tags
the font is fixed and makes things more readable

Your posts were edited to show you how the should look
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Sun Feb 26, 2012 2:14 pm    Post subject:
Reply with quote

Sunil,

Which example did you pick up? As Bill has also mentioned, SyncSort has got a bit different interface for JOINKEYS, look here: http://ibmmainframes.com/viewtopic.php?t=56870&highlight=joinkeys
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Sun Feb 26, 2012 2:57 pm    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

Quote:
Which example did you pick up?

the one in DFSORT smart tricks
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Sun Feb 26, 2012 3:23 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
[...]

and what are all the single quotes?


Looks like a facility from gsf.

sunil.sunny, does your site just code everything in the JCL itself? How does the maintenance go with that?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Sun Feb 26, 2012 4:02 pm    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

I found CCSS very useful for passing parameter to <DATA> cards inside a PROC
if properly used it saves quite a bit of work

no need for it with zOS 1.13 ( if it does the parameter substitution also for data cards )

but no reason at all to use it for STATIC data outside of a PROC

there is also a free version on the CBT tape
it needs to be reworked/streamlined a bit,
if You are interested let me know
and I can post the reworked/streamlined version
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Sun Feb 26, 2012 4:06 pm    Post subject: Re: Reply to: Overlay part of a record without affecting the
Reply with quote

enrico-sorichetti wrote:
Quote:
Which example did you pick up?

the one in DFSORT smart tricks
Hi Enrico,

I should have been clearer - I search for "//SYSIN SUBSYS=(CCSS", from his example and looked for that in the DFSort tricks document. It was not there and so is my inquiry...

Regards,
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Sun Feb 26, 2012 4:39 pm    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

Hi Anuj,

I think there's a "small" confusion by TS. When they say they got "a JCL" from the link enrico provided, they mean the sort cards from same. There is no way the Smart Dfsort Tricks would have such site-specific JCL.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Feb 26, 2012 5:54 pm    Post subject:
Reply with quote

my bad, did not bother to recognize the CCSS.
Back to top
View user's profile Send private message
sunil.sunny

New User


Joined: 25 Feb 2012
Posts: 5
Location: US

PostPosted: Sun Feb 26, 2012 9:23 pm    Post subject:
Reply with quote

Anuj Dhawan wrote:
Sunil,

Which example did you pick up? As Bill has also mentioned, SyncSort has got a bit different interface for JOINKEYS, look here: http://ibmmainframes.com/viewtopic.php?t=56870&highlight=joinkeys



I got one Syncsort JCL from the link mentioned by you:

Code:
//SORT   EXEC PGM=SORT 
//SORTJNF1 DD DISP=SHR,DSN=FILE1       
//SORTJNF2 DD DISP=SHR,DSN=FILE2       
//SORTOUT  DD DISP=SHR,DSN=FILE3
//SYSOUT   DD SYSOUT=*   
//SYSIN    DD *   
  JOINKEYS FILES=F1,FIELDS=(1,5,A) 
  JOINKEYS FILES=F2,FIELDS=(1,5,A) 
  JOIN UNPAIRED,F1                   
  REFORMAT FIELDS=(F1:1,10,F2:1,5)
  SORT FIELDS=COPY                   
/*


It works well for a scenario when the first 5 bytes in both of the input files are same but not if they mismatches.
My requirement is simple:
Input file 1: FB, LRECL - 10 bytes, will always have one record
Input file 2: FB, LRECL - 5 bytes, will always have one record
Output:
Output file: FB, LRECL - 15 bytes - should be created with first 10 bytes from I/P file 1 and next 5 bytes from I/P file 2. (Only one record)

Please note that I don't not need any matching to be performed before copying the data to Output file. I/P files data should be directly copied to O/P file.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Sun Feb 26, 2012 9:52 pm    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

Do you have a key, the same on each file? If 1,5 is the key on both files, they you already have the data, don't need to do the match, so I'll guess that you don't.

Do you have your Syncsort manual?

Did you find this example? Where you don't have a key, you make one, with a sequence number appended to each record. Look at Gerry's solution at the end of the topic linked-to.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Sun Feb 26, 2012 9:54 pm    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

Quote:
Please note that I don't not need any matching to be performed before copying the data to Output file. I/P files data should be directly copied to O/P file.


yes ... You do , You have the hidden logical key of the sequence number.

joinkeys as the name hints joins something based on a key
to sort based on the relative record number 1-1 2-2 3-3 ... n-n
You need to add a dummy key ( the sequence number ) in an unused postion of the records
and build the output dropping it
Back to top
View user's profile Send private message
sunil.sunny

New User


Joined: 25 Feb 2012
Posts: 5
Location: US

PostPosted: Mon Feb 27, 2012 12:35 am    Post subject: Re: Reply to: Overlay part of a record without affecting the
Reply with quote

enrico-sorichetti wrote:
Quote:
Please note that I don't not need any matching to be performed before copying the data to Output file. I/P files data should be directly copied to O/P file.


yes ... You do , You have the hidden logical key of the sequence number.

joinkeys as the name hints joins something based on a key
to sort based on the relative record number 1-1 2-2 3-3 ... n-n
You need to add a dummy key ( the sequence number ) in an unused postion of the records
and build the output dropping it



Thanks all for the support. The JCL is working now.... icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Feb 27, 2012 12:44 am    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

You could try this, borrowed form Gerry. It puts an 8-byte sequence number at start position 11 of each record on both files. Then does the join. If it doesn't work, it is my fault, not Gerry's :-)

I don't think you need the JOIN UNPAIRED, but since I don't have Syncsort docs that is something you can discover (and let us know).

If you fancy making a second control file for the copy of the 5-byte file, you could start that sequence number at position 6. Since I can't test it, I'm not going to do the change.

The REFORMAT will take bytes 1-10 of file one and 1-5 of file two, putting them next to each other and starting at position 1 (thus dropping the sequence numbers from both files).

Since you don't need to sort the output, there is just a COPY. Your new file will appear on SORTOUT.

enrico, even if TS isn't interested (they're paying already, I guess), I'd like to see the souped-up CBT thing you mentioned :-)

Code:
//S1       EXEC PGM=SYNCTOOL                                     
//IN1      DD *                                                 
123456789A                                                     
123456789B                                                     
123456789C                                                     
123456789D                                                     
123456789E                                                     
123456789F                                                     
//IN2      DD *                                                 
1234A                                                               
1234B                                                               
1234C
1234D                                                               
1234E
1234F
//IN1O     DD DSN=&&IN1O,DISP=(,PASS,DELETE),UNIT=SYSDA,         
//            SPACE=(TRK,(10,5),RLSE)                           
//IN2O     DD DSN=&&IN2O,DISP=(,PASS,DELETE),UNIT=SYSDA,         
//            SPACE=(TRK,(10,5),RLSE)                           
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//TOOLIN   DD *                                       
  COPY FROM(IN1) TO(IN1O) USING(CTL1)                 
  COPY FROM(IN2) TO(IN2O) USING(CTL1)                 
/*                                                     
//CTL1CNTL DD *                                       
   INREC OVERLAY=(11:SEQNUM,8,ZD)                     
/*                                                     
//S2       EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTJNF1 DD DSN=&&IN1O,DISP=(OLD,DELETE)             
//SORTJNF2 DD DSN=&&IN2O,DISP=(OLD,DELETE)             
//SORTOUT DD SYSOUT=*                                 
//SYSIN DD *                                           
  JOINKEYS FILE=F1,FIELDS=(11,8,A),SORTED             
  JOINKEYS FILE=F2,FIELDS=(11,8,A),SORTED             
  JOIN UNPAIRED                                       
  REFORMAT FIELDS=(F1:1,10,F2:1,5)                     
  OPTION COPY                                         
Back to top
View user's profile Send private message
Nikhil Jain

New User


Joined: 20 Jul 2011
Posts: 16
Location: India

PostPosted: Tue Feb 28, 2012 11:57 am    Post subject: Reply to: Overlay part of a record without affecting the ent
Reply with quote

Hi,

I have tried this in DFSORT. Please check if it works for you in Syncsort as well.

Code:
//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//INA      DD *                   
X1234                             
//INB      DD *                   
Y7868                             
//SORTOUT  DD SYSOUT=*           
//JNF1CNTL DD *                   
  INREC OVERLAY=(7:SEQNUM,1,ZD)   
//JNF2CNTL DD *                   
  INREC OVERLAY=(7:SEQNUM,1,ZD)   
//SYSIN    DD *                   
  JOINKEYS F1=INA,FIELDS=(7,1,A) 
  JOINKEYS F2=INB,FIELDS=(7,1,A) 
  JOIN UNPAIRED,F1               
  REFORMAT FIELDS=(F1:1,5,F2:1,5)
  SORT FIELDS=COPY               
//* 


SortOut -
Code:
X1234Y7868
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


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