Leading Zeros

Ask/Clarify the questions on EASYTRIEVE

Moderators: DikDude, Moderator Group

Post Reply
trushant
Member
Posts: 17
Joined: Thu Sep 12, 2013 5:21 pm

Leading Zeros

Post by trushant » Fri Jan 24, 2014 4:31 pm

Code: Select all

FileB
 ROW1   001 039 
 ROW3   040 015 N    MASK     'ZZZZZZZZZZZZZZZ' 
 ROW4   057 015 N   HEADING ('REPRESENTMENTS')  
 ROW5   074 015 N   HEADING ('UNPAIDS')         
 ROW6   092 015 N   HEADING &#40;'VALUE< R 100'&#41;    
 ROW7   109 015 N   HEADING &#40;'VALUE< R 1000'&#41;   
 ROW8   126 015 N   HEADING &#40;'VALUE< R 5000'&#41;   
 ROW9   143 015 N   HEADING &#40;'VALUE< R 10000'&#41;  
 ROW10  160 015 N   HEADING &#40;'TOTAL VALUE'&#41; 


Above is the stucture of my output file.
I write this file by moving date in the above fields.
I want leading zeros to be replaced by blanks.I specify mask for ROW3 as shown above but still getting leadiing zeros

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Jan 24, 2014 5:45 pm

In Easytrieve Plus, MASKs are only processed for printed output, from a DISPLAY or PRINT.

When you say "moving dat(a)", do you use MOVE? If so, use an assgnment instead (=), as MOVE does not work how you think it does if you know COBOL. It won't fix your problem, but generally using MOVE for data-items will bite you at some point.

You either have to do some code yourself, "redefiing" it as an A field and testing the bytes in a loop until you reach a non-zero. If you want to do that a lot, you can do it in an Easytrieve Plus macro, or as a File Exit.

What's that ROW1? Did you chop it when doing the copy/paste or does that somehow compile?

trushant
Member
Posts: 17
Joined: Thu Sep 12, 2013 5:21 pm

Post by trushant » Fri Jan 24, 2014 6:45 pm

Thanks William for your reply

I am using assgnment (=)

I want to suppress zeros for all variables from row3 to row10

Suggest an some approach

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Fri Jan 24, 2014 9:24 pm

Suggest an some approach
Suggest you re-read William's reply. He has suggested an approach.
Regards
Nic

trushant
Member
Posts: 17
Joined: Thu Sep 12, 2013 5:21 pm

Post by trushant » Mon Jan 27, 2014 9:02 am

William please theow some more light on the ways suggested

I am unable to understand the approch suggested

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Jan 27, 2014 11:58 pm

Hello,


As WC mentioned:
You either have to do some code yourself, "redefiing" it as an A field and testing the bytes in a loop until you reach a non-zero.
If explain where this does not work for you, maybe someone can clarify for you.

Suggest you get the routine working for one field. Then if there are several/many, modify this to a "generic" solution and invoke it as needed.
Have a good one

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others