How can I define a flat file in RPGLE?

5 pts.
Tags:
Flat files
RPG
RPGLE
How can I define a flat file in RPGLE?
ASKED: September 16, 2008  10:39 PM
UPDATED: September 19, 2008  11:49 AM

Answer Wiki

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

Here is an example. It is based on a file which has the same file/record/field name.
This happens when you create the file with the CRTPF and a length value.

<pre>
Fmyfile uf e disk rename (myfile : myRecord)
F prefix (m_)

D mystring s 15

C read myfile
C eval mystring = %subst(m_myfile : 1 :10)
C mystring dsply
C eval m_myfile = ‘xxxx’
C update myRecord
C eval *inlr = *on
C return</pre>

Discuss This Question: 1  Reply

 
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
  • graybeard52
    Here is an example. Note the "F" in format type & length of record on the file spec. Also, not the use of I-Spec to define field(s) in that record.
         FFlatFile  IPE  F  130        Disk
         FNewFile   O  A E             Disk
         IFlatFile      01
         I                                  1  130  FLAT
          /FREE
           Field1 = %subst(FLAT:1:10);
           Field3 = %subst(FLAT:21:10);
           Write NewFileRF;
          /END-FREE                 
    3,115 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