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
 

 

Conversion of Character to Numeric using SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Conversion of Character to Numeric using SYNCSORT
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Sat Feb 09, 2008 8:07 pm    Post subject:
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    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 Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am


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