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 

formatting the numeric field

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


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Mon Feb 09, 2004 10:33 am    Post subject: formatting the numeric field Reply with quote

Hi,
Is this possible using any utilities.?ie putting a comma for every thousand as given below.
Code:


Input
--------
1      20000.00
2      400.00
3      5000000.00
4      1000.00

Output
--------
1      20,000.00
2      400.00
3      5,000,000.00
4      1,000.00


_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Feb 09, 2004 10:55 am    Post subject: Reply with quote

Somu,

Is the decimal point variable or fixed? The data shown above has variable decimal point. What is the maximum length of the field? S9(09V9(2) ?

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


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Mon Feb 09, 2004 11:32 am    Post subject: Reply with quote

Kolusu,
I'm sorry that I didn't give a proper explanation in my previous post.
The declararon of the varable is S9(09)V9(3).

Regds
-Som
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Feb 09, 2004 11:44 am    Post subject: Reply with quote

Somu,

You still did not answer my first question , is the decimal point variable?.i.e
Code:

----+----1----+----2----+----3----+----4----+----5----+---
1      20000.00     <== DECIMAL STARTS AT 13             
2      400.00       <== DECIMAL STARTS AT 11             
3      5000000.00   <== DECIMAL STARTS AT 15             
4      1000.00      <== DECIMAL STARTS AT 12             


now if you see the above data the decimal is variable. Is it always as shown above? The declaration shows that you have 3 decimal digits but your sample data only shows 2 digits. can you clarify that?

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


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Mon Feb 09, 2004 12:18 pm    Post subject: Reply with quote

Kolusu,
The decimal point variable.
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Feb 09, 2004 1:06 pm    Post subject: Reply with quote

Somu,

The following DFSORT/ICETOOL JCL will give you the desired results. If you have syncsort at your shop then change the pgm name to synctool. A brief explanation of the job. I assumed that your input file is 80 bytes of length and is FB recfm.Also I assumed that you amount field starts at pos 5 with the following declaration 9(09)v9(2).


Since the decimal is a variable we need to split the records into different file depending upon the decimal position.using Inrec we add a seqnum at the end of each record , so that w can retain orginal sequence of the data.

The first copy operation splits the input record into different file depending on the position of the decimal.Using outrec we edit mask the amount field.

The second sort step takes all these temp files together and sorts on the seqnum , so that we retain the orginal sequence. we also strip off the seqnum while writting the final output.

Code:

//STEP0100 EXEC  PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN       DD *                                           
1   123456789.11                                           
2   23456789.22                                           
3   3456789.33                                             
4   456789.44                                             
5   56789.55                                               
6   6789.66                                               
7   789.77                                                 
8   89.88                                                 
9   9.99                                                   
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T3       DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T4       DD DSN=&T4,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T5       DD DSN=&T5,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T6       DD DSN=&T6,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T7       DD DSN=&T7,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T8       DD DSN=&T8,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T9       DD DSN=&T9,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//CON      DD DSN=&T1,DISP=OLD,VOL=REF=*.T1               
//         DD DSN=&T2,DISP=OLD,VOL=REF=*.T2               
//         DD DSN=&T3,DISP=OLD,VOL=REF=*.T3               
//         DD DSN=&T4,DISP=OLD,VOL=REF=*.T4               
//         DD DSN=&T5,DISP=OLD,VOL=REF=*.T5               
//         DD DSN=&T6,DISP=OLD,VOL=REF=*.T6               
//         DD DSN=&T7,DISP=OLD,VOL=REF=*.T7               
//         DD DSN=&T8,DISP=OLD,VOL=REF=*.T8               
//         DD DSN=&T9,DISP=OLD,VOL=REF=*.T9   
//OUT      DD DSN=YOUR OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,               
//             SPACE=(CYL,(X,Y),RLSE)             
//TOOLIN   DD *                                           
  COPY FROM(IN)  USING(CTL1)                             
  SORT FROM(CON) USING(CTL2)                             
//CTL1CNTL DD *                                           
  INREC FIELDS=(1,80,SEQNUM,8,ZD)                         
  OUTFIL FNAMES=T1,INCLUDE=(14,1,CH,EQ,C'.'),             
  OUTREC=(1,4,5,9,ZD,EDIT=(TTT,TTT,TTT),14,3,80:X,81,8)   
  OUTFIL FNAMES=T2,INCLUDE=(13,1,CH,EQ,C'.'),             
  OUTREC=(1,4,5,8,ZD,EDIT=(TT,TTT,TTT),13,3,80:X,81,8)   
  OUTFIL FNAMES=T3,INCLUDE=(12,1,CH,EQ,C'.'),             
  OUTREC=(1,4,5,7,ZD,EDIT=(T,TTT,TTT),12,3,80:X,81,8)     
  OUTFIL FNAMES=T4,INCLUDE=(11,1,CH,EQ,C'.'),             
  OUTREC=(1,4,5,6,ZD,EDIT=(TTT,TTT),11,3,80:X,81,8)       
  OUTFIL FNAMES=T5,INCLUDE=(10,1,CH,EQ,C'.'),             
  OUTREC=(1,4,5,5,ZD,EDIT=(TT,TTT),10,3,80:X,81,8)       
  OUTFIL FNAMES=T6,INCLUDE=(09,1,CH,EQ,C'.'),             
  OUTREC=(1,4,5,4,ZD,EDIT=(T,TTT),09,3,80:X,81,8)         
  OUTFIL FNAMES=T7,INCLUDE=(08,1,CH,EQ,C'.'),             
  OUTREC=(1,4,5,3,ZD,EDIT=(TTT),08,3,80:X,81,8)           
  OUTFIL FNAMES=T8,INCLUDE=(07,1,CH,EQ,C'.'),             
  OUTREC=(1,4,5,2,ZD,EDIT=(TT),07,3,80:X,81,8)           
  OUTFIL FNAMES=T9,SAVE,                                 
  OUTREC=(1,4,5,1,ZD,EDIT=(T),06,3,80:X,81,8)             
//CTL2CNTL DD *                                           
  SORT FIELDS=(81,8,ZD,A)                                 
  OUTFIL FNAMES=OUT,OUTREC=(1,80)                         
//*


Hope this helps...

Cheers

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


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Tue Feb 10, 2004 5:13 pm    Post subject: Reply with quote

Thanks Kolusu. It works great.
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 27, 2004 12:54 pm    Post subject: Reply with quote

With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can use DFSORT's new UFF format and IFTHEN and OVERLAY functions to do this more easily and efficiently with only one copy pass using a single INREC statement as follows:

Code:

//S1 EXEC  PGM=ICEMAN
//SYSOUT  DD SYSOUT=*
//SORTIN       DD *
1   123456789.11
2   23456789.22
3   3456789.33
4   456789.44
5   56789.55
6   6789.66
7   789.77
8   89.88
9   9.99
A   .99
B   .09
//SORTOUT      DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
     OVERLAY=(5:5,12,UFF,EDIT=(III,III,IIT.TT))),
   IFTHEN=(WHEN=(14,1,CH,EQ,C' '),OVERLAY=(5:15,4,10X)),
   IFTHEN=(WHEN=(13,1,CH,EQ,C' '),OVERLAY=(5:14,5,9X)),
   IFTHEN=(WHEN=(12,1,CH,EQ,C' '),OVERLAY=(5:13,6,8X)),
   IFTHEN=(WHEN=(11,1,CH,EQ,C' '),OVERLAY=(5:12,7,7X)),
   IFTHEN=(WHEN=(10,1,CH,EQ,C' '),OVERLAY=(5:11,8,6X)),
   IFTHEN=(WHEN=(9,1,CH,EQ,C' '),OVERLAY=(5:10,9,5X)),
   IFTHEN=(WHEN=(8,1,CH,EQ,C' '),OVERLAY=(5:9,10,4X)),
   IFTHEN=(WHEN=(7,1,CH,EQ,C' '),OVERLAY=(5:8,11,3X)),
   IFTHEN=(WHEN=(6,1,CH,EQ,C' '),OVERLAY=(5:7,12,2X)),
   IFTHEN=(WHEN=(5,1,CH,EQ,C' '),OVERLAY=(5:6,13,X))
/*


SORTOUT will have the following:

Code:

1   123,456,789.11   
2   23,456,789.22     
3   3,456,789.33     
4   456,789.44       
5   56,789.55         
6   6,789.66         
7   789.77           
8   89.88             
9   9.99             
A   0.99             
B   0.09             


For complete information on all of the new DFSORT and ICETOOL functions available with these DFSORT PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed May 17, 2006 2:13 pm    Post subject: Reply with quote

With z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006), you can use DFSORT's new JFY function to do this even more easily and efficiently with only one copy pass using a single INREC statement as follows:

Code:

//S1 EXEC  PGM=ICEMAN
//SYSOUT  DD SYSOUT=*
//SORTIN       DD *
1   123456789.11
2   23456789.22
3   3456789.33
4   456789.44
5   56789.55
6   6789.66
7   789.77
8   89.88
9   9.99
A   .99
B   .09
//SORTOUT      DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC OVERLAY=(5:5,12,UFF,EDIT=(III,III,IIT.TT),
          5:5,14,JFY=(SHIFT=LEFT))
/*


For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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