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

Overlay part of a record without affecting the entire record


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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Feb 25, 2012 10:38 pm
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.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
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
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Feb 26, 2012 1:20 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Feb 26, 2012 1:29 pm
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

Superior Member


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

PostPosted: Sun Feb 26, 2012 2:14 pm
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: ibmmainframes.com/viewtopic.php?t=56870&highlight=joinkeys
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Feb 26, 2012 2:57 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Feb 26, 2012 3:23 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Feb 26, 2012 4:02 pm
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

Superior Member


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

PostPosted: Sun Feb 26, 2012 4:06 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Feb 26, 2012 4:39 pm
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
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
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: 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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Feb 26, 2012 9:52 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Feb 26, 2012 9:54 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Feb 27, 2012 12:44 am
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
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
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Feb 28, 2012 2:06 pm
Reply with quote

Problem is if the Syncsort used doesn't have the JNFnCNTL files available. That's why it ends up as two steps.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Feb 28, 2012 2:13 pm
Reply with quote

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


the ts has already told that DFSORT control card do not work with SYNCSORT
after having used the example found in DFSORT smart tricks
no reason to REprovide soultion that are known not to work
icon_evil.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 28, 2012 2:14 pm
Reply with quote

[quote="enrico-sorichetti"]
Quote:

no reason to REprovide soultion that are known not to work
icon_evil.gif


yeah, but it increases the post count....
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 10:15 pm
Reply with quote

H Bill,

Thanks so much for the explanation.

Hi Enrico,

Apologies for the confusion. I am not at all familiar with the Syncsort but, thought could do it in DFSort. From the next time onwards, I am definitely going to be extra careful.

Not sure but, how does increasing the post count help.
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 10:29 pm
Reply with quote

Nikhil Jain wrote:
I am not at all familiar with the Syncsort but, thought could do it in DFSort.


& was under the impression that if it works in DFSort, it would most probably work in Syncsort as well. But, now I have understood that it is not the case.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top