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 

EZT help with stripping leading zeros

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


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Thu May 20, 2004 1:52 pm    Post subject: EZT help with stripping leading zeros Reply with quote

Hi ,
Do we've any statement similar to cobol's INSPECT statement in EZT.I need to strip leading zeros off from some of the feilds before writing to another file.

Thanks,
VIjay
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: Thu May 20, 2004 2:35 pm    Post subject: Reply with quote

Vijay,

Easytrieve does not have the function INSPECT. How ever you can acheive the results using DO UNTIL.

The following code will strip off the leading zeroes from the 10 byte numeric field
Code:

FILE FILEIN                                   
   IN-KEY                01 03  A             
   IN-QTY                05 10  N 0           
                                             
FILE FILEOUT                                 
   OUT-KEY               01 03  A             
   OUT-QTY               05 10  A             
                                             
W-SUB        W 02 N 0                         
W-NUM-FOUND  W 01 A                           
                                             
W-STRING     W 10 A                   
  W-STR   W-STRING 1 N OCCURS 10         
                                             
                                             
JOB INPUT FILEIN                             

  W-STRING       = IN-QTY           
  W-SUB          = 1         
  W-NUM-FOUND    = 'N'       


  DO UNTIL W-SUB GT 10 OR W-NUM-FOUND = 'Y'     
     IF W-STR (W-SUB) > 0                       
        W-NUM-FOUND = 'Y'                       
     ELSE                                       
        MOVE ' ' TO W-STR(W-SUB)                 
     END-IF                                     
     W-SUB       = W-SUB + 1                     
  END-DO                 

  OUT-KEY    = IN-KEY     
  OUT-QTY    = W-STRING   

  PUT FILEOUT                                 



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