Retrieving data into a COBOL/400 program

pts.
Tags:
Application development
Cynthia wrote in with this question recently: "How can the contents of a data area be retrieved into a COBOL/400 program?" -- Debra Tart, associate editor

Answer Wiki

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

In order to retrieve data into your cobol program you will have to define the data file and read it sequentailly parsing out defined fields in working storage

Discuss This Question: 2  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
  • Ashnirody
    There are three ways that I can think of to get data from a data area into your COBOL program. 1) Create a CL program and call it from your COBOL program. A simple example follows. START: PGM PARM(&DATA) DECLARE: DCL VAR(&DATA) TYPE(*CHAR) LEN(50) RETRIEVE: RTVDTAARA DTAARA(TESTDARA) RTNVAR(&DATA) FINIS: ENDPGM 2). Call QCMDEXC from your COBOL program to run the command RTVDTAARA. 3). Use an API to get the contents of the data area. I do not know the API off the top of my head. You will have to do a little work to research this. Good Luck. Ash
    100 pointsBadges:
    report
  • Roses06
    Agreed. We use the CL program approach in our shop and there seems to be no impact on performance.
    0 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