Program Described File in RPGIV

pts.
Tags:
RPG
RPGLE
Can any one send me an Example, How a Program Described File is used in RPGIV?

Answer Wiki

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

Hi

The trick is to code the file layout using the I-specs. The following is a simple example:

H DFTACTGRP(*NO)

FSrcFile IP F 92 Disk

D Char20 s 20a

ISrcFile Ns
I 1 6 2SrcSeq
I 7 12 0SecDat
I 13 92 SrcDta

C Eval Char20 = SrcDta
C Char20 Dsply

Here the file is defined as Input Primary so I haven’t had to worry about using READ, CHAIN, etc. Compile the program and then call it with:

OVRDBF FILE(SRCFILE) TOFILE(*LIBL/QCLSRC) OVRSCOPE(*JOB)
CALL program_name
DLTOVR FILE(SRCFILE) OVRSCOPE(*JOB)

You should see the first CL source member in your library list displayed line by line.

All of the other file operations work the same way as they do for externally defined files, you just have to define the key attributes in the F-spec if you want to use random access.

All the best

Jonathan

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
  • Kbarnette
    UTM400P is program described. File Specs 0025.00 FUTM400P IF F 96 DISK Input Specs 0153.00 * 0154.00 * Record layout for UTM400P 0155.00 * 0156.00 IUTM400P AA 1 C0 2 C0 3 C0 0157.00 I AND 4 C1 0158.00 I 11 22 CY 0159.00 I 31 42 CR 0160.00 I AA 0161.00 I 1 4 0RRNTHS 0162.00 I 5 6 0CALKEYmnth 0163.00 I 7 8 0CALKEYday 0164.00 I 9 10 0CALKEYyear 0165.00 I 14 14 0CALDAY Calc Specs 0188.00 C READ UTM400P 98 0189.00 C IF (*IN98 = *ON) OR 0190.00 C (CY(1) = *BLANKS) AND (CY(2) = *BLANKS) AND 0191.00 C (CY(3) = *BLANKS) 0192.00 C CALL 'QCMDEXC' 0193.00 C PARM CMD(2) 0194.00 C PARM 50 WKN155 0195.00 C GOTO ENDPGM 0196.00 C END 0248.00 C RRNTHS CHAIN UTM400P 98
    0 pointsBadges:
    report
  • TomLiotta
    What do you mean by "how a file is used"? A program-described file is used the same way an externally-described file is used. You READ them or WRITE them with the same instructions. Do you mean that you want to know how a program-described file is declared in a program? Tom
    125,585 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