move (or Eval) between record formats

200 pts.
Tags:
RPG
Isn't it possible to move a database file record format to a different format in one statement? i have tried move, movel, and eval, and still get errors. it seems it should be possible. thanks!

Answer Wiki

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

Assuming your record formats are identical, you can define external data structures for each format in your D specs. Then do something like this.

/free
RcdFmt2DS = RcdFmt1DS;
/end-free

============================================================

It’s not clear, but it sounds like you are looking for the <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fbooks_web%2Fc0925076406.htm”>EVAL-CORR op-code</a>. EVAL-CORR provides essentially what a MOVE CORRESPONDING statement in COBOL would provide.

Tom

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
  • PAVERS
    Example: FKLCUSFIL IF E K DISK FCAPIHC UF A E K DISK PREFIX(H) D CUSREC_DS E DS EXTNAME(CAPIHC) D CAPIHC_DS E DS EXTNAME(CAPIHC) Prefix(H) MOVEL CUSREC_DS CAPIHC_DS
    0 pointsBadges:
    report
  • Bdfgsbw
    What error are you getting? It is possible to move the data in one format to another, but you cannot use the file format name. The better solution is to use data structures to move the data. Then in the program, MOVE one data structure to the other. The only rule you need to follow is to insure the fields within the data structures line up. Ex1. D FLDATA E DS EXTNAME(FILE1) D FLSAVE E DS EXTNAME(FILE1) PREFIX(SV) . . . C MOVEL FLDATA FLSAVE In the above example, the DS's have the same format (reference the same file), and as long as the data structures have the same field positioning (definition) as the other, then the logic works. Ex2. D DS1 DS D FLD1 1 35 D FLD2 36 70 D FLD3 71 105 . . D DS2 DS D FFLD1 1 35 D FFLD2 36 70 . . C MOVEL DS1 DS2 This will work also. If the fields in the data structures do not line up, the you run the risk of corrupting the data. Hope this helps.
    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