Read a externally described file and write the record to another externally decribed file using RPGLE.

0 pts.
Tags:
RPGLE
The syntax that I have found is READ Filename (results) Datastructure name. Write filerecord name (results) Datastructure name. What is it that I am missing? I use externally described 'DS' in SQL programs for Fetch all the time. This application requires RPGLE. Compile error. RNF7701 20 1 The data structure is not allowed for the operation. RNF0202 20 1 Refer to the compiler listing where this message was first issued. 202 20 226 012600 THE RESULT DATA STRUCTURE DSSAHISAR DOES NOT INCLUDE A SUBFIELD IN POSITION 1 FOR RECORD SAHISAR. issued.
ASKED: November 20, 2006  2:16 PM
UPDATED: October 15, 2008  11:26 AM

Answer Wiki

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

if u need to use READ with Data structure,that file should be a PROGRAM DESCRIBED file.

READ file(pgm described.’F’ in position 22 of F-spec) data structure name.
with externally described file we can not do this operation.

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
  • 19521956
    You use a data structure to write to a program-described file. When you use an externally-described file you don't need to define a data structure. You move the values to each of the fields in the externally-described file and then you use the WRITE operation code, with the Result Field empty.
    0 pointsBadges:
    report
  • Ashnirody
    Here is how I would do it. FRESULTS IF A E DISK RENAME(RESULTS:RESULTR) DOUTDS DS LIKEREC(RESULTS:*OUTPUT) DINDS DS LIKEREC(RESULTS) C READ EPPATEMPW1 INDS C C* Make your changes to INDS fields here C C Eval OUTDS = INDS C WRITE RESULTR OUTDS Hope this works for you.
    100 pointsBadges:
    report
  • 19521956
    I quote from Read from the ILE RPG Reference Guide, for the Read Operation code: "The READ operation reads the record, currently pointed to, from a full procedural file (identified by an F in position 18 of the file description specifications). The name operand is required and must be the name of a file or record format. A record format name is allowed only with an externally described file (E in position 22 of the file description specifications). It may be the case that a READ-by-format-name operation will receive a different format from the one you specified in the name operand. If so, your READ operation ends in error. If the data-structure operand is specified, the record is read directly into the data structure. If name refers to a program-described file (identified by an F in position 22 of the file description specification), the data structure can be any data structure of the same length as the file?s declared record length. If name refers to an externally-described file or a record format from an externally described file, the data structure must be a data structure defined with EXTNAME(...:*INPUT) or LIKEREC(...:*INPUT)." You don't have to use a data structure. You can if you want to. If you do, then specify the data structure accordidng to the quotation.
    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