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

Conversion of Character to Numeric using SYNCSORT


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

New User


Joined: 26 Sep 2007
Posts: 25
Location: chennai

PostPosted: Wed Dec 12, 2007 1:42 pm
Reply with quote

Hi,

I want convert a character field of 21 bytes to Numeric field of 21 bytes of my input file.

Input file (34,21)

000000000212
0000034
000000003445
00000000000000456
.........

Output (1,21)

000000000000000000212
000000000000000000034
000000000000000003445
000000000000000000456
..............


Krishna
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Dec 12, 2007 3:47 pm
Reply with quote

skrishnavijay,

Please check with the following code for your requirement.
The below code will work fine provided your input(34,21) has trailing spaces and the code will not suitable for leading spaces.
Code:
// EXEC PGM=SORT                                     
//SORTIN DD *                                         
                                 000000000212         
                                 0000034             
                                 000000003445         
                                 00000000000000456   
/*                                                   
//SORTOUT DD SYSOUT=*                                 
//SYSOUT DD SYSOUT=*                                 
//SYSIN DD *                                         
 OPTION COPY                                                 
 INREC IFTHEN=(WHEN=(34,1,CH,EQ,C' '),BUILD=(21C'0')),       
       IFTHEN=(WHEN=(35,1,CH,EQ,C' '),BUILD=(20C'0',34,01)),
       IFTHEN=(WHEN=(36,1,CH,EQ,C' '),BUILD=(19C'0',34,02)),
       IFTHEN=(WHEN=(37,1,CH,EQ,C' '),BUILD=(18C'0',34,03)),
       IFTHEN=(WHEN=(38,1,CH,EQ,C' '),BUILD=(17C'0',34,04)),
       IFTHEN=(WHEN=(39,1,CH,EQ,C' '),BUILD=(16C'0',34,05)),
       IFTHEN=(WHEN=(40,1,CH,EQ,C' '),BUILD=(15C'0',34,06)),
       IFTHEN=(WHEN=(41,1,CH,EQ,C' '),BUILD=(14C'0',34,07)),
       IFTHEN=(WHEN=(42,1,CH,EQ,C' '),BUILD=(13C'0',34,08)),
       IFTHEN=(WHEN=(43,1,CH,EQ,C' '),BUILD=(12C'0',34,09)),
       IFTHEN=(WHEN=(44,1,CH,EQ,C' '),BUILD=(11C'0',34,10)),
       IFTHEN=(WHEN=(45,1,CH,EQ,C' '),BUILD=(10C'0',34,11)),
       IFTHEN=(WHEN=(46,1,CH,EQ,C' '),BUILD=(09C'0',34,12)),
       IFTHEN=(WHEN=(47,1,CH,EQ,C' '),BUILD=(08C'0',34,13)),
       IFTHEN=(WHEN=(48,1,CH,EQ,C' '),BUILD=(07C'0',38,14)),
       IFTHEN=(WHEN=(49,1,CH,EQ,C' '),BUILD=(06C'0',34,15)),
       IFTHEN=(WHEN=(50,1,CH,EQ,C' '),BUILD=(05C'0',34,16)),
       IFTHEN=(WHEN=(51,1,CH,EQ,C' '),BUILD=(04C'0',34,17)),
       IFTHEN=(WHEN=(52,1,CH,EQ,C' '),BUILD=(03C'0',34,18)),
       IFTHEN=(WHEN=(53,1,CH,EQ,C' '),BUILD=(02C'0',34,19)),
       IFTHEN=(WHEN=(54,1,CH,EQ,C' '),BUILD=(01C'0',34,20)),
       IFTHEN=(WHEN=NONE,BUILD=(34,21))                     
/*
//
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Dec 12, 2007 4:03 pm
Reply with quote

Code:
//STEP1    EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                   
                                 000000000212     
                                 0000034           
                                 000000003445     
                                 00000000000000456
----+----1----+----2----+----3----+----4----+----5-
/*                                                 
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  OPTION COPY                                     
  OUTREC OVERLAY=(1:34,21,UFF,M11,LENGTH=21,22:69X)
/*                                                 


SORTOUT
Code:
000000000000000000212
000000000000000000034
000000000000000003445
000000000000000000456
Back to top
View user's profile Send private message
skrishnavijay

New User


Joined: 26 Sep 2007
Posts: 25
Location: chennai

PostPosted: Thu Dec 13, 2007 12:04 pm
Reply with quote

Thanks a lot krisprems...!!

Regards,
Krishna
Back to top
View user's profile Send private message
piyush_katariya

New User


Joined: 14 Jan 2008
Posts: 3
Location: india

PostPosted: Sat Feb 09, 2008 5:12 pm
Reply with quote

I have a same requiement but in my case i want to convert it into decimal value

input 0.00
output 0.00

How can i convert it into
Back to top
View user's profile Send private message
piyush_katariya

New User


Joined: 14 Jan 2008
Posts: 3
Location: india

PostPosted: Sat Feb 09, 2008 5:14 pm
Reply with quote

the input value is c'0.00'
the output value should be 0.00
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: Sat Feb 09, 2008 8:07 pm
Reply with quote

Hello,

Why does anything need to be converted? The values are already numeric.

Please clarify or add additional example data that will show what kind of conversion is needed.
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 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts file manager is doing string conversion IBM Tools 3
Search our Forums:

Back to Top