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

Trying to convert amounts.....


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Michaelod
Warnings : 1

New User


Joined: 02 Sep 2008
Posts: 49
Location: Edinburgh

PostPosted: Tue Oct 13, 2009 6:25 pm
Reply with quote

I have the following input file:

Code:
+0000000000000000000000000200.10,+0000000000000000000000000200.10
-0000000000000000000000000100.20,-0000000000000000000000000100.20


We'll call the amounts amt 1 and amt 2.

I need to create an audit file with 4 amount fields as follows:

Amt 1 total debits,Amt 1 total credits,Amt 2 total debits,Amt 2 total credits

I get the following output:

Code:
-0000000000000000000000000100.20,+0000000000000000000000000200.10,-0000000000000000000000000100.20,+0000000000000000000000000200.10


using the following data:

Code:
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'-'),                           
        OVERLAY=(66:1,32),HIT=NEXT),                           
      IFTHEN=(WHEN=(1,1,CH,EQ,C'+'),                           
        OVERLAY=(98:1,32),HIT=NEXT),                           
      IFTHEN=(WHEN=(34,1,CH,EQ,C'-'),                           
        OVERLAY=(130:34,32),HIT=NEXT),                           
      IFTHEN=(WHEN=(34,1,CH,EQ,C'+'),                           
        OVERLAY=(162:34,32))                                     
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,                             
OUTREC=(1,51,80X),                                               
TRAILER1=(1:TOT=(66,32,SFF,EDIT=(STTTTTTTTTTTTTTTTTTTTTTTTTTTT.TT),
          SIGNS=(-)),                                             
          SEPERATOR,                                             
          TOT=(98,32,SFF,EDIT=(STTTTTTTTTTTTTTTTTTTTTTTTTTTT.TT),
          SIGNS=(+)),                                             
          SEPERATOR,                                             
          TOT=(130,32,SFF,EDIT=(STTTTTTTTTTTTTTTTTTTTTTTTTTTT.TT),
          SIGNS=(-)),                                             
          SEPERATOR,                                             
          TOT=(162,32,SFF,EDIT=(STTTTTTTTTTTTTTTTTTTTTTTTTTTT.TT),
          SIGNS=(+)))


However, I require the amount fields inthe audit record to have 4 decimal places rather than 2 as follows:

Code:
-00000000000000000000000100.2000,+00000000000000000000000200.1000,-00000000000000000000000100.2000,+00000000000000000000000200.1000


Each field should still be 32 bytes long.

Can anyone help?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Oct 13, 2009 8:43 pm
Reply with quote

Michaelod,

Try these control cards

Code:

//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=INIT,                                             
  BUILD=(+100,MUL,01,32,SFF,PD,LENGTH=16,                               
         +100,MUL,34,32,SFF,PD,LENGTH=16,                               
         +0,TO=PD,LENGTH=16,+0,TO=PD,LENGTH=16)),                       
  IFTHEN=(WHEN=(01,16,PD,LT,0),                                         
  OVERLAY=(33:1,16,1:+0,TO=PD,LENGTH=16),HIT=NEXT),                     
  IFTHEN=(WHEN=(17,16,PD,LT,0),                                         
  OVERLAY=(49:17,16,17:+0,TO=PD,LENGTH=16))                             
                                                                       
  OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,BUILD=(131X),                     
  TRAILER1=(1:TOT=(33,16,PD,EDIT=(STTTTTTTTTTTTTTTTTTTTTTTTTT.TTTT),   
            SIGNS=(+,-)),                                               
            SEPERATOR,                                                 
            TOT=(01,16,PD,EDIT=(STTTTTTTTTTTTTTTTTTTTTTTTTT.TTTT),     
            SIGNS=(+)),                                                 
            SEPERATOR,                                                 
            TOT=(49,16,PD,EDIT=(STTTTTTTTTTTTTTTTTTTTTTTTTT.TTTT),     
            SIGNS=(+,-)),                                               
            SEPERATOR,                                                 
            TOT=(17,16,PD,EDIT=(STTTTTTTTTTTTTTTTTTTTTTTTTT.TTTT),     
            SIGNS=(+)))                                                 
Back to top
View user's profile Send private message
Michaelod
Warnings : 1

New User


Joined: 02 Sep 2008
Posts: 49
Location: Edinburgh

PostPosted: Tue Oct 13, 2009 9:39 pm
Reply with quote

Should the lengths not be 32?

What would happen if any of the amount fields are 0 or spaces?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Oct 13, 2009 10:06 pm
Reply with quote

Michaelod wrote:
Should the lengths not be 32?


yes the length is indeed 32.

Michaelod wrote:
What would happen if any of the amount fields are 0 or spaces?


why don't you run the job and see it yourself?
Back to top
View user's profile Send private message
Michaelod
Warnings : 1

New User


Joined: 02 Sep 2008
Posts: 49
Location: Edinburgh

PostPosted: Wed Oct 14, 2009 2:21 pm
Reply with quote

Skolusu,

Your code doesnt work........it gives me output as follows:

Code:
808080808080808080808080808.0808,808080808080808080808080808.0808,808080808080808080808080808.0808,808080808080808080808080808.0808


Why do I have to convert the amounts to PD?
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: Wed Oct 14, 2009 7:30 pm
Reply with quote

Hello,

Please post the informational messages (including the message ids) from this run.

PD is used by the underlying assembler instruction to edit the output value.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Oct 14, 2009 9:54 pm
Reply with quote

Michaelod wrote:
Skolusu,

Your code doesnt work........it gives me output as follows:

Code:
808080808080808080808080808.0808,808080808080808080808080808.0808,808080808080808080808080808.0808,808080808080808080808080808.0808


Why do I have to convert the amounts to PD?


Did you run with the same input you showed me? show me the JCL you used and also sample input atleast the first 15 records
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
No new posts Convert HEX to Numeric DB2 3
Search our Forums:

Back to Top