MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

leading zeroes in decimal number

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
jathampy
Beginner


Joined: 21 Dec 2007
Posts: 18
Topics: 7
Location: UK

PostPosted: Thu Sep 26, 2019 2:51 pm    Post subject: leading zeroes in decimal number Reply with quote

I am having a file that contain decimal numbers listed below (position 1 and length 8)
Code:

189.99
1213.22
169

I need leading zeros to be in the output file as shown
Code:

00189.99
01213.22
00169.00

Tried using 1,8,UFF,EDIT=(TTTTT.TT) but last row is coming as 00001.69.

I am to get correct output using
OUTREC IFTHEN=(WHEN=(1,8,SS,NE,C'.'),OVERLAY=(6:C'.00'))
OUTFIL OVERLAY=(1:1,8,UFF,EDIT=(TTTTT.TT))

But I think this can be done in simple way

Could you please help.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Oct 02, 2019 11:08 pm    Post subject: Reply with quote

Jathampy,

Your input has both numeric digits with decimal dot as well as pure integers. so you need to handle them a bit differently, so that you can append .00 at the end for integers.

Use the following untested DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
189.99                                                   
1213.22                                                 
169                                                     
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  OPTION COPY                                           
  ALTSEQ CODE=(40F0)                                     
  INREC IFTHEN=(WHEN=(1,8,SS,EQ,C'.'),                   
       OVERLAY=(01:1,8,JFY=(SHIFT=RIGHT),               
                01:1,8,TRAN=ALTSEQ)),                   
        IFTHEN=(WHEN=NONE,                               
       OVERLAY=(01:1,5,JFY=(SHIFT=RIGHT),               
                01:1,8,TRAN=ALTSEQ,                     
                06:C'.00'))                             
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jathampy
Beginner


Joined: 21 Dec 2007
Posts: 18
Topics: 7
Location: UK

PostPosted: Fri Oct 04, 2019 1:20 pm    Post subject: Reply with quote

Many Thanks Kolusu. It worked.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group