Trap decimal data error in COBOL/400

350 pts.
Tags:
CL
COBOL/400
Decimal Data Error
I mean how to trap decimal data error in COBOL400 as we do monmsg command in cl. Is there any same way in COBOL400?

Answer Wiki

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

you could set the data type on the field to D this means only digts 0-9 can be entered

Michael Dratwa wrote:
Have the numeric field redefined as alphanumeric (or move the field to a test alphanumeric fld) and use the test for numeric’s.

01 ws-data-record.
05 ws-data-fld1 pic 9(5).
05 ws-data-fld1x redefines ws-data-fld1 pic x(5).
05 …

if ws-data-fld1x not numeric
(do error routine)
else
….
end-if.

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
  • Kapiltiwari
    Can u clear it more. write a simple line of code
    350 pointsBadges:
    report
  • NullFields
    You can write an error handler that can be invoked by the cobol program similar to how MONMSG works in CL. Look at Chapter 6 of the COBOL USERS GUIDE. Also, depending on the verb used when the data decimal occured, you might be able to capture in with the verbs ON SIZE syntax. You can also learn more about that in the COBOL USER GUIDE. The guide mentioned above is for the OPM Cobol. If you are actually and ILE/COBOL instead of COBOL/400, this is the link. (Chapter 16).
    880 pointsBadges:
    report
  • Supriyob2
    if Variable (var) is alpahanumeric : If var is numeric move var to num-var else .... if ur cobol pgm gets called from CLP then and a numeric value is being passed from CLP to a numeric field in cobol : make the numeric varibale in cobol as comp-3. Supriyo
    165 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