Exfmt opcode

1150 pts.
Tags:
EXFMT operation
EXFMT statement
RPG
RPGLE
Hi in a display file i can have many record formats.But while using them for I/O operations in the RPG programs can i use multiple EXFMT operation at different places? And how to control it in loops.Give me an example. Also tell me sample code for F12-cancel to go to the previous screen of display using RPGLE.thanks

Answer Wiki

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

Hi,

Yes, you can have multiple EXFMT opcodes at different places in your program. Controlling loops is normally done using the DOWxx or DOUxx opcodes – this depends on which method you prefer, here’s an example :-

<b>DOWxx</b>
*IN03 DOWEQ *OFF
*IN12 ANDEQ *OFF
EXFMT SCREEN01
*IN03 IFEQ *OFF
*IN12 ANDEQ *OFF
*** Enter is pressed, process the screen data.
ENDIF
ENDDO
MOVE *OFF *IN12

The *IN12 (F12 key) is set off after the loop.

<b>DOUxx</b>
EXFMT SCREEN01
*IN03 IFEQ *OFF
*IN12 ANDEQ *OFF
*IN03 DOUEQ *ON
*IN12 OREQ *ON
*** Enter is pressed, process the screen data.
EXFMT SCREEN01
ENDDO
ENDIF
MOVE *OFF *IN12

Once again, the *IN12 (F12 key) is set off after the loop.

This is only a rough example of how the DO loops work. There are other methods as well. Hope it helps.

Regards,

Martin Gilbert.

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
  • ten2008
    HI thx for ur reply.But i still get confused with leave and iter usage. Please help me particularly to code using ITER to skip a iteration. Also tell me can i use exfmt at any place?
    1,150 pointsBadges:
    report
  • Gilly400
    Hi, Personally I try to avoid using LEAVE and ITER. I consider them bad programming practice (they remind me too much of GOTO and CABxx and can make the flow of the program confusing). Anyway, basically, the ITER opcode takes you back to the beginning of your loop (following statement after your DOxx) and the LEAVE opcode takes you to the following statement after the end of your loop (ENDDO). Regards, Martin Gilbert.
    23,730 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