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

Need help with converting 9(13)V9(3) to S9(13).9(5)-syncsort


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

New User


Joined: 11 Apr 2007
Posts: 10
Location: India

PostPosted: Tue Jan 08, 2008 3:19 pm
Reply with quote

My input field is declared as 9(13)V9(3). Is there a possibility to convert this to a S9(13).9(5) field using the outrec statement (Product in use is Syncsort).
The input field is at offset 95 and the output field offset is 120.
Also, we are moving it to a signed variable only for consistency with someother file with which we would be merging this output file. But the input file value will always be positive.

So I could think of the below approach
Code:

OUTREC FIELDS=(120:C' ',
            121:95,13,       
            133:C'.',       
            134:108,3,     
            137:C'00')       


But i feel the above is too crude and just wanted to know if there is a better way to achieve this.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Jan 08, 2008 3:44 pm
Reply with quote

Code:
//*******************************************************           
//STEP1    EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
         1234567890123123                                           
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
           SORT FIELDS=COPY                                         
     OUTREC FIELDS=(20:10,16,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(,))
/*                                                                 
                                                       

SORTOUT
Code:
                    1234567890123.123
Back to top
View user's profile Send private message
Samantha Chelikani

New User


Joined: 11 Apr 2007
Posts: 10
Location: India

PostPosted: Tue Jan 08, 2008 3:52 pm
Reply with quote

Hi Krisprems,
Thanks a lot.
But if the input is
Code:

1234567890123123

I need the output as (Yes i need the zeroes at the end)
Code:

1234567890123.12300
 

Also, if the input is
Code:

0000067890123123

I need the output as
Code:

0000067890123.12300

Can this be done?
Sorry for not making this clear in the first post. icon_redface.gif
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Jan 08, 2008 4:04 pm
Reply with quote

Code:
//*******************************************************             
//STEP1    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
         1234567890123123                                             
         0000067890123123                                             
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
           SORT FIELDS=COPY                                           
 OUTREC FIELDS=(20:10,16,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(,),C'000')
/*                                                                     


SORTOUT
Code:
                    1234567890123.123000
                    0000067890123.123000
Back to top
View user's profile Send private message
Samantha Chelikani

New User


Joined: 11 Apr 2007
Posts: 10
Location: India

PostPosted: Tue Jan 08, 2008 5:30 pm
Reply with quote

Thanks Krisprems... It worked....
I wanted only 5 digits after the decimal so i replaced
Code:

C'000')

with
Code:

C'00')
 
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Jan 08, 2008 6:07 pm
Reply with quote

Samantha Chelikani

Good that you found it yourself icon_wink.gif
Back to top
View user's profile Send private message
Samantha Chelikani

New User


Joined: 11 Apr 2007
Posts: 10
Location: India

PostPosted: Tue Jan 08, 2008 6:16 pm
Reply with quote

hmm.... well i thought i'd b considered reaaallly dumb if i couldnt figure atleast that out icon_biggrin.gif
Back to top
View user's profile Send private message
Samantha Chelikani

New User


Joined: 11 Apr 2007
Posts: 10
Location: India

PostPosted: Wed Jan 30, 2008 1:18 pm
Reply with quote

hi,

My requirement has now changed and they are going to send me the input field as S9(13)V999 COMP-3. I need to change this to S9(13).9(5). Can you please suggest me an outrec statement to achieve this.
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Wed Jan 30, 2008 5:15 pm
Reply with quote

Hi Samantha,

It requires a small modification to previous code. ZD needs to be replaced by PD and byte length will change to 9. S9(13)V999 COMP-3 requires 9 bytes.

//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=....
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(20:Startcol,9,PD,
EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(,),C'00')
/*


Let me know if it works.....


-Ajay
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Converting fixed length file to excel... IBM Tools 7
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
Search our Forums:

Back to Top