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 field to output

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

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Mar 04, 2011 3:12 pm    Post subject: Overlay field to output
Reply with quote

Hi,

I want to overlay two fields from input file to output i am using the below code which should overlay the fields but it is copying all fields

Please some one correct the code.Thanks

Code:

SORT FIELDS=COPY                 
OUTREC OVERLAY=(271:03,9,286:52,3)



Regards,
Pavan.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Mar 05, 2011 12:40 am    Post subject:
Reply with quote

It's not clear from your description what you're trying to do.

OVERLAY overlays just the fields you tell it to, but it copies the rest of the record as is. Your statement keeps the input record as is, but overlays output positions 271-279 with input positions 3-11, and overlays output positions 286-288 with input positions 52-54.

If you just want to include two fields from the input record to the output record, you would use BUILD, not OVERLAY.

I can't help you further unless you explain what you're actually trying to do. Do you want to copy just two fields from input to output or do something else? What is the starting position and length of the input fields? What do you want in the output record and where?
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Mon Mar 07, 2011 11:26 am    Post subject: Reply to: Overlay field to output
Reply with quote

Hello Frank,

what you explained is correct,

I want to overlay the 2 fields 3-11,52-54(new A/c num and code) from input file to fields 271-279,286-288(old A/C num and code) in output and the rest of the fields in output should remain as is.

I am just replacing the old A/C num and code in output file with new A/c num and code in input file.

My concern here is the code below does'nt overlay two fields instead it copies all i/p fields to o/p.

Please advise the solution,Thanks for your help.

Regards,
Pavan.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Mar 07, 2011 8:11 pm    Post subject:
Reply with quote

Hello,

Is there some reason you have not posted some sample input data and the output you want from the sample data? These do not need to be full-length records - just enough to demonstrate the requirement.

Also mention the recfm and lrecl of the files along with any "processing rules".
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Mar 07, 2011 8:29 pm    Post subject:
Reply with quote

Quote:
I want to overlay the 2 fields 3-11,52-54(new A/c num and code) from input file to fields 271-279,286-288(old A/C num and code) in output and the rest of the fields in output should remain as is.


Is there any chance that you are processing 2 files? File-1 containing data in positions 3-11 and 52-54 that you want to use to overlay positions 271-279 and 286-288 in File-2?

Garry.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Mar 08, 2011 12:28 am    Post subject:
Reply with quote

Pavin,

What you're saying makes no sense. If I have an input record like this:

Code:

RR<AAAAAAA>SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS<B>T...T 


and I use your control statements:

Code:

  SORT FIELDS=COPY                   
  OUTREC OVERLAY=(271:03,9,286:52,3)


I get an output record like this:

Code:

RR<AAAAAAA>SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS<B>T...T<AAAAAAA>TTTTTT<B>T...T 


where 271-279 is overlaid with 3-11 and 286-288 is overlaid with 52-54 and the rest of the input data remains unchanged.

If that's NOT what you're getting, then you need to show what you are getting for output, as well as the complete set of JES messages.

If that is what you're getting, but it's NOT what you want, then you need to show what you want.
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Mar 11, 2011 8:30 pm    Post subject: Reply to: Overlay field to output
Reply with quote

Hello Frank/Garry Carroll,

Sorry for the delay in replying i was bit busy.

Yes,I am processing two files

consider below example

if the sortin dataset has
Code:

AAA LLL 111 ALPHA
BBB MMM 222 BETA
CCC NNN 333 GAMMA

if the sortout dataset has
Code:

XXX 123 PPP ONE   
YYY 456 QQQ TWO   
ZZZ 789 RRR THREE


After the job completes sortout dataset should be
Code:

XXX 111 PPP ONE 
YYY 222 QQQ TWO 
ZZZ 333 RRR THREE


I think my code doesn't work in this case. Sorry guys i was confused and troubled you.

Frank is there any solution for the above requirement with out going to cobol .Thanks.


Regards,
Pavan.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Fri Mar 11, 2011 10:13 pm    Post subject:
Reply with quote

Hello,

How/why is there an "output" file before the process begins?

Do you really have 2 input file and want to create a new output with some alterations?

You should not overwrite an input file as you have described.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Mar 11, 2011 11:28 pm    Post subject:
Reply with quote

Pavan,

Assuming you have two input files and want to create an output file by matching the records one-by-one, you would use JOINKEYS, not OVERLAY.
Here's an example of a JOINKEYS job with the input you showed and assuming your input file has RECFM=FB and LRECL=80. You can adapt it as necessary.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
AAA LLL 111 ALPHA
BBB MMM 222 BETA
CCC NNN 333 GAMMA
//IN2 DD *
XXX 123 PPP ONE
YYY 456 QQQ TWO
ZZZ 789 RRR THREE
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(81,8,A),SORTED,NOSEQCK
  JOINKEYS F2=IN2,FIELDS=(81,8,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F2:1,4,F1:9,3,F2:8,73)
  OPTION COPY
//JNF1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD)
//JNF2CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD)
/*
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Mon Mar 14, 2011 11:34 am    Post subject: Reply to: Overlay field to output
Reply with quote

Hi Frank,

Thank you very much for the replying,

i am getting following error when i try to run the job i guess because i am using syncsort.

Code:

SYSIN :                                         
  JOINKEYS F1=IN1,FIELDS=(81,8,A),SORTED,NOSEQCK
           *                                   
  JOINKEYS F2=IN2,FIELDS=(81,8,A),SORTED,NOSEQCK
           *                                   
  REFORMAT FIELDS=(F2:1,4,F1:9,3,F2:8,73)       
  OPTION COPY                                   
WER268A  JOINKEYS STATEMENT: SYNTAX ERROR       
WER268A  JOINKEYS STATEMENT: SYNTAX ERROR       
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000   
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE   


Please show me corresponding code in syncosort.

Regards,
Pavan.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Mon Mar 14, 2011 12:10 pm    Post subject: Reply to: Overlay field to output
Reply with quote

You should know that Frank is DFSORT developer! and You have no reason to ask Him for advice on SYNCSORT ( a competitor' s product )

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: Tue Mar 15, 2011 7:01 pm    Post subject:
Reply with quote

Below code will do the same logic in syncsort

Code:
//S1 EXEC PGM=ICETOOL                                                   
//SYSOUT DD SYSOUT=*                                                   
//TOOLMSG   DD  SYSOUT=*                                               
//DFSMSG    DD  SYSOUT=*                                               
//FILEA    DD *                                                         
AAA LLL 111 ALPHA                                                       
BBB MMM 222 BETA                                                       
CCC NNN 333 GAMMA                                                       
//FILEB    DD *                                                         
XXX 123 PPP ONE                                                         
YYY 456 QQQ TWO                                                         
ZZZ 789 RRR THREE                                                       
//CTL3JNF1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)     
//CTL3JNF2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)     
//FILEC    DD SYSOUT=*                                                 
//TOOLIN DD *                                                           
COPY FROM(FILEA) TO(CTL3JNF1) USING(CTL1)                               
COPY FROM(FILEB) TO(CTL3JNF2) USING(CTL1)                               
COPY FROM(CTL3JNF1) TO(FILEC) USING(CTL3)                               
//CTL1CNTL DD *                                                         
  INREC OVERLAY=(70:SEQNUM,8,ZD)                                       
//CTL3CNTL DD *                                                         
  JOINKEYS FILE=F1,FIELDS=(70,8,A),SORTED                               
  JOINKEYS FILE=F2,FIELDS=(70,8,A),SORTED                               
  REFORMAT FIELDS=(F2:1,4,F1:9,3,F2:8,73)                               
  SORT FIELDS=COPY                                                     
/*                                                                     
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Wed Mar 16, 2011 8:20 pm    Post subject: Reply to: Overlay field to output
Reply with quote

Hi kratos86,

Thank you for the solution.

Regards,
Pavan.
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 Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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