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

Replacing a column of data in a PS


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Mon Sep 12, 2011 12:06 pm
Reply with quote

Hi,

I have two datasets and below are the details:
Datset1:
Record lenght: 2119

Dataset2:
Record lenght:10

I want to replace the contents of columns 22 to 31 of Dataset1 with Dataset2's data.Remaining data in the Dataset1 should remain same.Can you please let me know how to achieve this with DFSORT/ICETOOL?
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 Sep 12, 2011 12:10 pm
Reply with quote

How many records on Dataset2?

If more than one, how do they match to Dataset1?

We assume Fixed-length records?
Back to top
View user's profile Send private message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Mon Sep 12, 2011 12:14 pm
Reply with quote

Hi Bill,

Record count of both datasets is same and they are Fixed-lenght.I don't have any matching records that is the problem here.I just want to replace the columns 22 to 31 of Dataset1 with 1-10 columns of dataset2.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Mon Sep 12, 2011 12:36 pm
Reply with quote

Hello pullaiah,

Here is the approach

1. Add sequence numbers to both the input files.
2. Use Joinkeys to match upon the sequence number and reformat the fields to include your column from file2 to file1.
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 Sep 12, 2011 12:36 pm
Reply with quote

So you have a one-for-one relationship between the two files (no key stuff).

Whilst the sort wizards are having their tea/coffee and biscuits, why don't you look up the word "cartesian" in your sort manual.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Sep 12, 2011 12:41 pm
Reply with quote

Hello,
try this,
Code:

//JOINS    EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//IN1      DD DSN=DATASET1-LRECL2119,DISP=SHR   
//IN2      DD DSN=DATASET2-LRECL10,DISP=SHR     
//SORTOUT  DD DSN=OUTPUT-DATASET,DISP=OLD       
//SYSIN    DD *                                 
 JOINKEYS F1=IN1,FIELDS=(2120,8,A),SORTED,NOSEQCK
 JOINKEYS F2=IN2,FIELDS=(11,8,A),SORTED,NOSEQCK 
 REFORMAT FIELDS=(F1:1,21,F2:1,10,F1:32,2088)   
 OPTION COPY                                     
/*                                               
//JNF1CNTL DD *                                 
 INREC OVERLAY=(2120:SEQNUM,8,BI)               
/*                                               
//JNF2CNTL DD *                                 
 INREC OVERLAY=(11:SEQNUM,8,BI)                 
/*                                               


P.S Tested with 80 LRECL datasets.
Back to top
View user's profile Send private message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Mon Sep 12, 2011 1:13 pm
Reply with quote

Hi Vasanth,
I have used the given code but below error

JOINKEYS STATEMENT: SYNTAX ERROR
JOINKEYS STATEMENT: SYNTAX ERROR

Please check once
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Sep 12, 2011 1:17 pm
Reply with quote

as usual you forgot to tell ..
what <SORT> product You are using and it' s <level> (version/release)

run this job and POST the results
Code:
****** ***************************** Top of Data ******************************
 000001 //SORTLEVL JOB NOTIFY=&SYSUID,                                         
 000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                       
 000003 //*                                                                     
 000004 //S1      EXEC PGM=SORT                                                 
 000005 //SYSOUT    DD SYSOUT=*                                                 
 000006 //SORTIN    DD *                                                       
 000007 DUMMY                                                                   
 000008 //SORTOUT   DD SYSOUT=*,                                               
 000009 //             DCB=(RECFM=FB,LRECL=80)                                 
 000010 //SYSIN     DD *                                                       
 000011   OPTION COPY                                                           
 ****** **************************** Bottom of Data ****************************


so that people willing to help might post a solution compatible wit Your sort <level>

if Your <level> of <SORT> does not provide JOINKEY functionality
search the forums. there are solution using ICETOOL and SPLICE
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Sep 12, 2011 2:06 pm
Reply with quote

or is possibly syncsort
Back to top
View user's profile Send private message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Mon Sep 12, 2011 2:26 pm
Reply with quote

We are using SYNCSORT FOR Z/OS 1.3.2.1R in our shop, I ran many jobs with JOINKEYS option and didn't find any difficulty earleir.Amy I getting above error only bacause of SORT version? Please calrify.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Sep 12, 2011 2:34 pm
Reply with quote

Quote:
Please check once

why don' t You check Yourself ???
Quote:
Amy I getting above error only bacause of SORT version? Please calrify.

we have nothing to clarify icon_evil.gif

You asked a question, You were given a good answer.
You whined that id did not work without giving any other explanation

since many of the question related to JOINKEY are due to the sort <level>
asking about it is the fastest way to avoid wasting time

You are getting the error because...
how in h311 could we know
the reason is that you made some error in implementing the suggestion given amen

if You want good answers learn to post good questions
Back to top
View user's profile Send private message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Mon Sep 12, 2011 3:00 pm
Reply with quote

Code:
Code:

//STEP01   EXEC PGM=SORT                                   
//IN1   DD  DSN=TCORP01.BETA02.BETA.TRADE.G0003V00,DISP=SHR
//IN2   DD  DSN=TCORP01.BETA.ACCOUNT.SORT.TEST6,DISP=SHR   
//SORTOUT DD  DSN=TCORP01.BETA02.BETA.TRADE(+1),           
//             DISP=(NEW,CATLG,DELETE),                   
//             DCB=(RECFM=FB,LRECL=2119)                   
//SYSOUT  DD SYSOUT=*                                     
//SYSPRINT DD SYSOUT=*                                     
//SYSIN DD *                                               
 JOINKEYS F1=IN1,FIELDS=(2120,8,A),SORTED,NOSEQCK         
 JOINKEYS F2=IN2,FIELDS=(11,8,A),SORTED,NOSEQCK           
 REFORMAT FIELDS=(F1:1,21,F2:1,10,F1:32,2088)             
 OPTION COPY                                               
/*                                                         
//JNF1CNTL DD *                                           
 INREC OVERLAY=(2120:SEQNUM,8,BI)                         
/*                                                         
//JNF2CNTL DD *                                           
 INREC OVERLAY=(11:SEQNUM,8,BI)                           
/*                                                         

I have checked everything in my code and couldn't find any error.I don't what's wrong with the above code,that's why I asked your help to resolve it.Please help me on this.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Sep 12, 2011 3:10 pm
Reply with quote

Quote:
I ran many jobs with JOINKEYS option and didn't find any difficulty earleir

36_11_6.gif hard to believe
if You had we would not be here wasting time
what about looking at one of the jobs You were using and investigate the differences

since You posted in the dfsort forum You were give a dfsort solution

while providing the same functionalities the two products differ in some keywords

so start doing a bit of the work You are getting paid for

search the forums for JOINKEYS and specify to search only the JCL forum

the answer is there waiting to be picked up,
I checked an the error is evident

no reason for You not to be able to do it Yourself
but naturally You are too <any adjective of Your choice> to try icon_evil.gif

edited to add ...
topic moved where it belongs
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Mon Sep 12, 2011 3:24 pm
Reply with quote

The solution vasanth provided is for DFSORT.

Since you are using SYNCSORT and it does not support JNF1CNTL, JNF2CNTL and NOSEQCK parameters. So you need to split the single step into three steps

1. Add sequence number to file1
2. Add sequence number to file 2
3. Match using the join keys and reformat the ouput


Similar kind of requirement is solved using syncsort here
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Sep 12, 2011 10:40 pm
Reply with quote

Hello,

Quote:
why don't you look up the word "cartesian" in your sort manual.
TS is not looking for a cartesian product. . . Just a one-for-one combination process.
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 Sep 13, 2011 3:30 am
Reply with quote

Whoops... icon_redface.gif

Thanks Dick, mouth running-off at the shoulder (or point further south).
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Sep 13, 2011 8:11 am
Reply with quote

Hi Bill,

Not to worry . . . icon_wink.gif

I sometimes suffer from the same afflicton and am thankful whan someone lets me know.

d
Back to top
View user's profile Send private message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Tue Sep 13, 2011 10:47 am
Reply with quote

Hi kratos,

I got the required output by following your steps,thanks a lot.

Thank you all for your valuable suggestions and will keep this in mind when I post anything next time.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Sep 13, 2011 10:53 am
Reply with quote

Good to hear you have something working - thank you for letting us know icon_smile.gif

Someone will be here when there are new questions. . .

d
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 Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts How to load to DB2 with column level ... DB2 6
No new posts SCOPE PENDING option -check data DB2 2
No new posts RC query -Time column CA Products 3
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top