Hi;
I'm new to this forum. I accidentially attached my first post to another post (sorry) so I'm re-posting it here as it's own subject.
I need to modify an Easytrieve to extract a dollar amount from a database and write a comma delimited output file. I need the dollar amount to be zero filled with a decimal point. Example: $157.00 should be written in the output file as: 00157.00
I am a COBOL programmer struggling with an Easytrieve. This is what I've tried per Dick's suggestion.
(I'm only showing the lines relavant to my question)
Input field:
CT05-CHRG 92 4 P 2
Output field:
EXTRO-CHRG 84 8 A
Work Fields:
W-CHRG W 7 N 2 MASK ('99999.99')
W-CHRG-RD W-CHRG 7 A
Additional Code:
W-CHRG = CT05-CHRG
EXTRO-CHRG = W-CHRG-RD
PUT EXTRO
I'm getting 0015700 (no decimal point)
How do I get the output file to contain 00157.00?
What am I doing wrong.
Dan
How to Write Amount to CSV File
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: How to Write Amount to CSV File
Hi Dan,
Unfortunately, i'm not connected tonight and cannot provide anything tested.
You might change this
toand give it a shot.
I'm out most of tomorrow (won't be connected to a mainframe), but will check the forum.
Which release of Easytrieve is used on your system?
Unfortunately, i'm not connected tonight and cannot provide anything tested.
You might change this
Code: Select all
W-CHRG W 7 N 2 MASK ('99999.99')
to
Code: Select all
W-CHRG S 8 N 2 MASK ('99999.99')
I'm out most of tomorrow (won't be connected to a mainframe), but will check the forum.
Which release of Easytrieve is used on your system?
Hope this helps,
d.sch.
d.sch.
-
- Posts: 4
- Joined: Tue Jul 21, 2009 9:51 pm
- Skillset: COBOL, IMS, DB2 for 30+ years
- Referer: I did a search on easytrieve forum
Re: How to Write Amount to CSV File
Hi Dick;
I tried your suggestion, but, unfortunately it did not work. I still do not get the actual decimal point in the output record.
We are using Easytrieve Plus 11-C, SP3
Currently I am writing the output extract records as a file. After going over the Easytrieve manual again, the thought occurred to me that maybe I need to change the output to a printer report. Just direct the "report" to disk with the proper lrecl (147) and have no headings. Let Easytrieve think it is writing a printed report with all of the proper edit masks being applied, but, in reality it's writing detail report lines (my extract output records) to disk. What do you think of that idea?
Another option is to re-write it in COBOL
Dan
I tried your suggestion, but, unfortunately it did not work. I still do not get the actual decimal point in the output record.
We are using Easytrieve Plus 11-C, SP3
Currently I am writing the output extract records as a file. After going over the Easytrieve manual again, the thought occurred to me that maybe I need to change the output to a printer report. Just direct the "report" to disk with the proper lrecl (147) and have no headings. Let Easytrieve think it is writing a printed report with all of the proper edit masks being applied, but, in reality it's writing detail report lines (my extract output records) to disk. What do you think of that idea?
Another option is to re-write it in COBOL

Dan
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: How to Write Amount to CSV File
Hi Dan,
Somewhere long ago (before ezt was even a CA product), someone decided that edited fields go on reports and raw data fields go in files. . . . Of course, back then no one was downloading to a spreadsheet or an ssis package or. . . Edited fields were horrible to use as "input"
I don't have access to an r11 system, but will look around and see what i can find.
Writing a "report" should get the decimal. Give it a try and let us know what happens.What do you think of that idea?
Somewhere long ago (before ezt was even a CA product), someone decided that edited fields go on reports and raw data fields go in files. . . . Of course, back then no one was downloading to a spreadsheet or an ssis package or. . . Edited fields were horrible to use as "input"

I don't have access to an r11 system, but will look around and see what i can find.
Hope this helps,
d.sch.
d.sch.
-
- Posts: 4
- Joined: Tue Jul 21, 2009 9:51 pm
- Skillset: COBOL, IMS, DB2 for 30+ years
- Referer: I did a search on easytrieve forum
Re: How to Write Amount to CSV File
Hello again;
I tried extracting my data as a "report", but got this B070 Error:
It looks like can't have a printed line as long as I need.
I ended up doing this:
and this:
It get's the job done, but with lots more code than I would like.
Dan
I tried extracting my data as a "report", but got this B070 Error:
Code: Select all
110 REPORT RPT-01 +
PRINTER RPT01 +
LINESIZE 250
110 *******B070 VALUE NOT WITHIN ACCEPTABLE RANGE - LINESIZE
It looks like can't have a printed line as long as I need.
I ended up doing this:
Code: Select all
W-DP W 1 A VALUE '.'
W-CHRG W 7 N 2
W-CHRG-DOLS W-CHRG 5 N 0
W-CHRG-CENTS W-CHRG +05 2 N 0
and this:
Code: Select all
W-CHRG = CT05-CHRG
EXTRO-CHRG-DOLS = W-CHRG-DOLS
EXTRO-DP-1 = W-DP
EXTRO-CHRG-CENTS = W-CHRG-CENTS
It get's the job done, but with lots more code than I would like.
Dan
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: How to Write Amount to CSV File
Thought I was time-warping here...
I wrote a reply to the question you accidently attached to another. I can't see the definition of your EXTRO- fields, but I assume EXTRO-CHRG-CENTS is 2 A, to get around the signed number problem?
MtClimber wrote:W-DP W 1 A VALUE '.'
W-CHRG W 7 N 2
W-CHRG-DOLS W-CHRG 5 N 0
W-CHRG-CENTS W-CHRG +05 2 N 0
and this:
W-CHRG = CT05-CHRG
EXTRO-CHRG-DOLS = W-CHRG-DOLS
EXTRO-DP-1 = W-DP
EXTRO-CHRG-CENTS = W-CHRG-CENTS
I wrote a reply to the question you accidently attached to another. I can't see the definition of your EXTRO- fields, but I assume EXTRO-CHRG-CENTS is 2 A, to get around the signed number problem?
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: How to Write Amount to CSV File
Hello,
To repeat. . .
It is best to NOT reply to old, inactive topics. . .
d
To repeat. . .
It is best to NOT reply to old, inactive topics. . .
d
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: How to Write Amount to CSV File
Sorry again, I was obviously writing that one while you were complaining about the first. Not much I can do about that.
Do you have it in your power to just purge this stuff then. Looking through the FAQs I don't think I can do it. Also, can't find unsubscribe.
Do you have it in your power to just purge this stuff then. Looking through the FAQs I don't think I can do it. Also, can't find unsubscribe.
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: How to Write Amount to CSV File
Hello,
If you believe those were "complaints" suggest a look around - those were simply gentle reminders.
I'm not aware of an "unsubscribe". . .
Suggest also you look at a lot of other forums and see if you find some that encourage re-awakening multi-year inactive topics. I'm not aware of any that encourage this, but i've only been a participant of 15 or so over the years. . .
Not to worry. . .Sorry again, I was obviously writing that one while you were complaining about the first. Not much I can do about that.

If you believe those were "complaints" suggest a look around - those were simply gentle reminders.
Yes, moderators can delete posts or entire topics. No, general members can't.Do you have it in your power to just purge this stuff then.
I'm not aware of an "unsubscribe". . .
Suggest also you look at a lot of other forums and see if you find some that encourage re-awakening multi-year inactive topics. I'm not aware of any that encourage this, but i've only been a participant of 15 or so over the years. . .
Hope this helps,
d.sch.
d.sch.
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: How to Write Amount to CSV File
"If someone suggested you refrain, they should be able to explain why. . ."
As I tried to explain before, people are reading these forums to get, successfuly, information that may help them, according to posts I have read.
I realise that the answers are no good to the original questioner, which is why I didn't answer any of those until it was pointed out to me that this is "A Help & Support Forum for Mainframe Beginners and Students". If this is so, and other beginners and students are going to have the same types of problems as others have had previously, what is the problem with me (or anyone else) going through the old problems hoping that the answers might help beginners and students, and maybe even getting those new beginners and students to think that if they have a problem not covered already on these boards, that they may get answers to their new questions?
I posted a couple of things in the "suggestions" board, because looking through previous posts a lot of things tend to go "dead". OK, seems people on here don't think that that is a problem. Are you going to get rid of my posts on "old" topics, or are you just happy if I don't do any more. Many of the old ones there is not enough information, but some there is information to be able to provide some possible answers, which may help beginners and students, and some even which may stop those same being somewhat confused by some answers given.
For me, Easytrieve Plus is a very useful tool. It can be used for very complex tasks, whilst at the same time keeping things simple. But it can be used badly, very badly. Something that looks like it works, but doesn't completely or all the time. Anyone care? If so, is this board part of that discussion or not?
As I tried to explain before, people are reading these forums to get, successfuly, information that may help them, according to posts I have read.
I realise that the answers are no good to the original questioner, which is why I didn't answer any of those until it was pointed out to me that this is "A Help & Support Forum for Mainframe Beginners and Students". If this is so, and other beginners and students are going to have the same types of problems as others have had previously, what is the problem with me (or anyone else) going through the old problems hoping that the answers might help beginners and students, and maybe even getting those new beginners and students to think that if they have a problem not covered already on these boards, that they may get answers to their new questions?
I posted a couple of things in the "suggestions" board, because looking through previous posts a lot of things tend to go "dead". OK, seems people on here don't think that that is a problem. Are you going to get rid of my posts on "old" topics, or are you just happy if I don't do any more. Many of the old ones there is not enough information, but some there is information to be able to provide some possible answers, which may help beginners and students, and some even which may stop those same being somewhat confused by some answers given.
For me, Easytrieve Plus is a very useful tool. It can be used for very complex tasks, whilst at the same time keeping things simple. But it can be used badly, very badly. Something that looks like it works, but doesn't completely or all the time. Anyone care? If so, is this board part of that discussion or not?
-
- Similar Topics
- Replies
- Views
- Last post
-
-
regarding COBOL WRITE verb (VB File Handling)
by anonguy456 » Mon Jun 28, 2021 5:57 pm » in IBM Cobol - 6
- 3845
-
by Robert Sample
View the latest post
Tue Jun 29, 2021 11:33 pm
-
-
- 3
- 2651
-
by sergeyken
View the latest post
Sat Nov 16, 2024 11:05 pm
-
-
EZIOE004 Logical I/O error on file occurred reading VB file
by savitha_y » Mon Feb 15, 2021 7:54 pm » in CA-Easytrieve - 3
- 4953
-
by savitha_y
View the latest post
Wed Feb 17, 2021 5:02 am
-
-
-
File Handling 3 input files and 1 output file by using EZT
by pavan426 » Thu Sep 09, 2021 12:17 am » in CA-Easytrieve - 0
- 4414
-
by pavan426
View the latest post
Thu Sep 09, 2021 12:17 am
-
-
-
Need to check whether file is ESDS file or not by using REXX
by Devrana » Sat Oct 05, 2024 2:28 pm » in CLIST & REXX - 6
- 3100
-
by sergeyken
View the latest post
Tue Oct 08, 2024 5:25 pm
-