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

Syncsort: Change a column value depending on other column


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

New User


Joined: 30 Oct 2007
Posts: 3
Location: India

PostPosted: Wed Oct 31, 2007 1:51 pm
Reply with quote

I have an input file length = 300. In the output file I need to have the column position 251-253 changed to '01 ' if column 33-35 is '29 '. Is it possible to do so in a single sort step?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 1:56 pm
Reply with quote

nithya,

Yes, this is possible with the OVERLAY command.

Quote:
I need to have the column position 251-253 changed to '01 ' if column 33-35 is '29


check if you have mentioned the correct column no's as cols 251 - 253 (3 bytes) and you want that to be replaced with a 2 byte value.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Oct 31, 2007 2:00 pm
Reply with quote

Nithya,

Second thought -

Check this link for an example -

www.ibmmainframes.com/viewtopic.php?t=25280&highlight=overlay
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 2:03 pm
Reply with quote

nitya,

Code:
//S2    EXEC  PGM=ICEMAN                                             
//SYSOUT    DD  SYSOUT=*                                             
//SORTIN DD DSN= input file,DISP=SHR                         
//SORTOUT DD DSN=output file,DISP=(,CATLG,DELETE)           
//SYSIN    DD    *                                                   
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=(33,2,CH,EQ,C'29'),OVERLAY=(251:C'01'))   
/*   
Back to top
View user's profile Send private message
nithya_s_raman

New User


Joined: 30 Oct 2007
Posts: 3
Location: India

PostPosted: Wed Oct 31, 2007 2:51 pm
Reply with quote

I tried using the options provided, but when I run the job its giving syntax error. Maybe IFTHEN and OVERLAY are not supported by syncsort.

Thanks for all your help.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Oct 31, 2007 2:59 pm
Reply with quote

Nitya,

Post the spool messages. May be some will help you out.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 3:00 pm
Reply with quote

nithya,

Quote:
Maybe IFTHEN and OVERLAY are not supported by syncsort.


What version of SYNCSORT are you using? Try using BUILD instead of OVERLAY

Code:
SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=(33,2,CH,EQ,C'29'),BUILD=(1,250,251:C'01',253,48)) 
Back to top
View user's profile Send private message
nithya_s_raman

New User


Joined: 30 Oct 2007
Posts: 3
Location: India

PostPosted: Wed Oct 31, 2007 3:20 pm
Reply with quote

I think the version of syncsort is 1.1
The build option is also not working. here is a copy of the spool.
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(33,3,CH,EQ,C'29 '),
*
BUILD=(1,250,251:C'01 ',254,47))
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 3:45 pm
Reply with quote

Nitya,

Quote:
Maybe IFTHEN and OVERLAY are not supported by syncsort.


Even am using SYNCSORT but the version is not the one which you are using. As you said IFTHEN and OVERLAY are not supported by the SYNCSORT version which you are using.
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Wed Oct 31, 2007 5:00 pm
Reply with quote

Can u try this ????

Code:
   OPTION COPY
   INREC IFTHEN=(WHEN=(33,2,CH,EQ,C'29'),OVERLAY=(251:C'01'))



Syam
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 31, 2007 6:19 pm
Reply with quote

skkp2006
What version of SYNCSORT you are using?
Check it in SPOOL, and let us know!
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Thu Nov 01, 2007 9:35 am
Reply with quote

I am using SYNCSORT FOR Z/OS 1.2.2.2R. I think that the above code requires SyncSort for z/OS 1.2.1 or later.

Syam
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Nov 02, 2007 11:05 am
Reply with quote

skkp2006 wrote:
I am using SYNCSORT FOR Z/OS 1.2.2.2R. I think that the above code requires SyncSort for z/OS 1.2.1 or later.

Syam

Have no idea as to exactly from which version the SYNCSORT has capability for IFTHEN.
icon_idea.gif The only way of verification i could think of is, if the * is exactly below the IFTHEN then you dont have facility of IFTHEN.
Like this
Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(33,3,CH,EQ,C'29 '),
      *
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts 3270 personal communications. Can't c... TSO/ISPF 2
Search our Forums:

Back to Top