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
 

 

SFF problems with decimal data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Wed Dec 19, 2012 7:28 am    Post subject: SFF problems with decimal data
Reply with quote

Hi,

I have the following data that I want to reformat.

input
Code:
ARCA,ARCA,C,,0.00085
ARCA,ARCA,F,,0.003
ARCA,ARCA,G,,0.0005
ARCA,ARCA,L,,0.003
ARCA,ARCA,M,,-0.0015


desired output
Code:

ARCAARCAC  00008500
ARCAARCAF  00030000
ARCAARCAG  00005000
ARCAARCAL  00030000
ARCAARCAM  00015000-


I am using the following sort card
Code:
 OPTION COPY
 INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=4),
              %02=(ENDBEFR=C',',FIXLEN=4),
              %03=(ENDBEFR=C',',FIXLEN=2),
              %04=(ENDBEFR=C',',FIXLEN=1),
              %05=(ENDBEFR=C',',FIXLEN=8)),
       BUILD=(%01,%02,%03,%04,%05,SFF,TO=ZD,LENGTH=8)
 OUTREC FIELDS=(1,11,
               (12,08,ZD,MUL,+1000),
                EDIT=(TTTTTTTTS),SIGNS=(,,,-))


but I am ending up with the following:
Code:
ARCAARCAC  00085000
ARCAARCAF  00003000
ARCAARCAG  00005000
ARCAARCAL  00003000
ARCAARCAM  00015000-


It seems like since SFF does not retain decimal place, my data is getting messed up because my input file is not padded with zeroes. Is there a way to fix this?

Thanks.
Back to top
View user's profile Send private message

hailashwin

New User


Joined: 16 Oct 2008
Posts: 73
Location: Boston

PostPosted: Wed Dec 19, 2012 1:54 pm    Post subject:
Reply with quote

Please check if this works for you..

Code:

//SYSIN    DD  *                                                   
  OPTION COPY                                                     
  INREC FINDREP=(STARTPOS=14,ENDPOS=21,IN=C' ',OUT=C'0')           
  OUTREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=4),                       
                %02=(ENDBEFR=C',',FIXLEN=4),                       
                %03=(ENDBEFR=C',',FIXLEN=2),                       
                %04=(ENDBEFR=C',',FIXLEN=1),                       
                %05=(ENDBEFR=C' ',FIXLEN=8)),                     
         BUILD=(%01,%02,%03,%04,%05,SFF,TO=ZD,LENGTH=8)           
  OUTFIL BUILD=(1,11,12,8,ZD,MUL,+10,EDIT=(TTTTTTTTS),SIGNS=(,,,-))
//*                                                               



Output:
Code:

ARCAARCAC  00008500
ARCAARCAF  00030000
ARCAARCAG  00005000
ARCAARCAL  00030000
ARCAARCAM  00001500-


Thanks,
Ashwin.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Dec 19, 2012 2:00 pm    Post subject: Reply to: SFF problems with decimal data
Reply with quote

hailashwin, did you check that final figure?

darkstar13,

Having identified what is happening, it is only a small step to a resolution. If it can't be done one way, look for another.

Although the leading minus sign complicates, you can get rid of the "." with a simple rearrangement of data, and change trailing spaces to zero with FINDREP or by multiple IFTHENs, with perhaps other possibilities.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Dec 19, 2012 3:51 pm    Post subject: Reply to: SFF problems with decimal data
Reply with quote

Hi darkstar13,

You can try this -

Code:

//STEP1   EXEC PGM=SORT                                               
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT DD SYSOUT=*                                                   
//SORTIN   DD *                                                       
ARCA,ARCA,C,,0.00085                                                   
ARCA,ARCA,F,,0.003                                                     
ARCA,ARCA,G,,0.0005                                                   
ARCA,ARCA,L,,0.003                                                     
ARCA,ARCA,M,,-0.0015                                                   
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
 OPTION COPY                                                           
  INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=4),                           
               %02=(ENDBEFR=C',',FIXLEN=4),                           
               %03=(ENDBEFR=C',',FIXLEN=2),                           
               %04=(ENDBEFR=C',',FIXLEN=1),                           
               %05=(ENDBEFR=C'.',FIXLEN=2),                           
               %06=(FIXLEN=5)),                                       
 OVERLAY=(%01,%02,%03,%04,%05,JFY=(SHIFT=RIGHT),                       
       14:%06,ZD,EDIT=(TTTTT),10X,                                     
       12:12,08,JFY=(SHIFT=RIGHT),                                     
       12:12,08,SFF,TO=ZD,LENGTH=08)                                   
 OUTREC OVERLAY=(12:13,7,ZD,MUL,+100,EDIT=(TTTTTTTTS),SIGNS=(,,,-),10X)


And Output :-

Code:

ARCAARCAC  00008500 
ARCAARCAF  00030000 
ARCAARCAG  00005000 
ARCAARCAL  00030000 
ARCAARCAM  00015000-


Thanks
-3nadh
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Dec 19, 2012 11:59 pm    Post subject:
Reply with quote

darkstar13,

Use the following DFSORT JCL which will give you the desired results. I assumed that your final number has S9V9(7) with trailing sign.

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                                 
ARCA,ARCA,C,,0.00085                           
ARCA,ARCA,F,,0.003                             
ARCA,ARCA,G,,0.0005                             
ARCA,ARCA,L,,0.003                             
ARCA,ARCA,M,,-0.0015                           
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=4),     
               %02=(ENDBEFR=C',',FIXLEN=4),     
               %03=(ENDBEFR=C',',FIXLEN=2),     
               %04=(ENDBEFR=C',',FIXLEN=1),     
               %05=(ENDBEFR=C'.',FIXLEN=2),     
               %06=(FIXLEN=7)),                 
        BUILD=(%01,%02,%03,%04,                 
               %05,SFF,EDIT=(T),%06,TRAN=ALTSEQ,
               %05,SFF,EDIT=(S),SIGNS=(,-))     
  ALTSEQ CODE=(40F0)                           
//*


The output from this is
Code:

ARCAARCAC  00008500
ARCAARCAF  00030000
ARCAARCAG  00005000
ARCAARCAL  00030000
ARCAARCAM  00015000-
Back to top
View user's profile Send private message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Thu Dec 20, 2012 5:45 am    Post subject:
Reply with quote

Hi Bodatrinadh, Skolusu,

Thanks a lot. It was a brilliant idea to parse using the decimal point ;)

I got the result that I wanted.

To Hailashwin and Bill, thanks for your reply. Your input is very much appreciated too. ;)
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Unable to copy data from spool in a d... srikant314 JCL & VSAM 8 Fri Jul 28, 2017 9:10 pm
No new posts Paasing symbolic parameter to instrea... Robert Sample JCL & VSAM 2 Thu Jul 27, 2017 1:22 pm
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 3 Wed Jul 26, 2017 9:11 pm
No new posts copying data without knowing location Arun Raj DFSORT/ICETOOL 12 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm


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