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

Overlay field to output


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


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

PostPosted: Sat Mar 05, 2011 12:40 am
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
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

Moderator Emeritus


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

PostPosted: Mon Mar 07, 2011 8:11 pm
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

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Mon Mar 07, 2011 8:29 pm
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 Developer


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

PostPosted: Tue Mar 08, 2011 12:28 am
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
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

Moderator Emeritus


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

PostPosted: Fri Mar 11, 2011 10:13 pm
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 Developer


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

PostPosted: Fri Mar 11, 2011 11:28 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Mar 14, 2011 12:10 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts REXX/CMS How to place command console... CLIST & REXX 4
No new posts Reroute print output via REXX/SDSF TSO/ISPF 6
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts Concatenate 2 input datasets and give... JCL & VSAM 2
No new posts How to turn off 'ACTION' SDSF output ... TSO/ISPF 2
Search our Forums:

Back to Top