Justify right in COBOL
30 pts.
0
Q:
Justify right in COBOL
I have data where the format has been changed slightly by the carrier and now this change is causing my job to abend. The last page number of each file reads ex.'160 OF 160' however, the new format must read '160 of 160' which means that the last page number needs to justfied to the right to pos 68. This change only needs to be made at the end if the file. How do I accomplish this? Should there be a JUSTIFY command in the code below that will do this? IF END-OF-FILE-2 (RESPONSE-PAGE-A EQUAL RESPONSE-PAGE-B AND RESPONSE-OF EQUAL ' OF ') SET END-OF-MESSAGES TO TRUE GO TO 0300-EXIT.
ASKED: Oct 19 2009  4:33 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
285 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
If you know how to ID the line which contains your "xxx of xxx", you could use the "UNSTRING" command. You can set it up to unstring on a space into multiple fields and then use those fields to reformat or process your last page and ignore the other pages.
Last Answered: Oct 20 2009  1:56 PM GMT by MDratwa   285 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

TomLiotta   7555 pts.  |   Oct 20 2009  7:20AM GMT

A little more clarification…? Why only the last page? AFAIK, there is no JUSTIFY statement in COBOL; there is JUSTIFIED [RIGHT] attribute of a data element for right-justification of output. That would obviously affect every page unless you used a different format for all other pages.

Tom

 

Tm2009   30 pts.  |   Oct 20 2009  12:12PM GMT

I know it is a little odd, but I can give you a little more information on why only the last page.
We have a job that process this data, which comes from an outside company. Somehow the data format was changed by the outside company for reasons we don’t know. Only the last page of each file was reformatted, now we need to change our program to comply with the new format.

Last page format should be:
PAGE: 160 OF 160 (the last digit should always be in column 68)

The DATASET LRECL IS 133

I hope this helps.

 

Tm2009   30 pts.  |   Oct 20 2009  12:19PM GMT

Example:
PAGE: 160 OF (space) (space) 160(the last digit should always be in position68)

 
0