Justify right in COBOL

30 pts.
Tags:
COBOL debugging
COBOL/400
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: October 19, 2009  4:33 PM
UPDATED: October 20, 2009  1:57 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    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
    125,585 pointsBadges:
    report
  • Tm2009
    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.
    30 pointsBadges:
    report
  • Tm2009
    Example: PAGE: 160 OF (space) (space) 160(the last digit should always be in position68)
    30 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following