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 

Convert Alphanumeric to signed numeric in Easytrieve

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


Joined: 22 Jun 2005
Posts: 41
Topics: 14

PostPosted: Thu Oct 27, 2005 8:52 am    Post subject: Convert Alphanumeric to signed numeric in Easytrieve Reply with quote

The following requirement is in easytrieve
I have a numeric field defined as X(13)

Quote:

WS-RATE W 13 A
WS-RATE-S WS-RATE 1 A
WS-RATE-N WS-RATE +1 7 A
WS-RATE-P WS-RATE +8 1 A
WS-RATE-D WS-RATE +9 4 A


I need to convert this to a signed numeric field. I have to display in my output as signed numeric. Please let me know how to do this ?

I tried to define a field

Quote:

WS-RATE1 W 12 N 4


and I did
MOVE WS-RATE TO WS-RATE1 I got a S0C7 error.

I even tried defining WS-RATE1 W 6 P 4 and moved WS-RATE TO WS-RATE1. I got a S0C7 error.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Oct 27, 2005 10:59 am    Post subject: Reply with quote

geetha001,

Try this untested code.

Code:

//STEP0100 EXEC PGM=EZTPA00                     
//STEPLIB  DD DSN=EASYTREV.LOADLIB,   
//            DISP=SHR                           
//SYSPRINT DD SYSOUT=*                           
//SYSOUT   DD SYSOUT=*                           
//SYSSNAP  DD SYSOUT=*                           
//SYSUDUMP DD SYSOUT=*                           
//INFILE   DD *                                 
+0123456.7890                                   
-0000234.0000                                   
//OUTPUT   DD SYSOUT=*,                         
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0) 
//*                                             
//SYSIN    DD *                                 
                                                 

  FILE INFILE                                             
       AMT-S            01 001 A                           
       AMT-NUM          *  007 N                           
       AMT-DOT          *  001 A                           
       AMT-DEC          *  004 N                           
                                                           
                                                           
  W-NUM           W  11 N 0                               
  W-AMT1 W-NUM       07 N 0                               
  W-AMT2 W-NUM   +07 04 N 0                               
                                                           
  FILE OUTPUT  FB(0 0)                                     
       O-AMT      01 11 N 0                               
                                                           
***********************************************************
* MAINLINE                                                 
***********************************************************
                                                           
 JOB INPUT INFILE                                         
                                                           
   W-NUM      = 0                                         
   W-AMT1     = AMT-NUM                                   
   W-AMT2     = AMT-DEC                                   
                                                           
   IF AMT-S   = '-'                                       
      W-NUM   = W-NUM * -1                                 
   END-IF                                                 
                                                           
   O-AMT      = W-NUM                                     
   PUT OUTPUT                                             
/*

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


Joined: 22 Jun 2005
Posts: 41
Topics: 14

PostPosted: Thu Oct 27, 2005 1:02 pm    Post subject: Reply with quote

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 -> Application Programming 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