rpgle programming

55 pts.
Tags:
RPGLE
RPGLE Program
when i call my rpg program the display screen is not exiting though i have added CF03 function in the DDS of the display file,or is something wrong with my program and here is the rpgle code to get the date for a particular id..

********************************************************

FDSPF  CF E                   WORKSTN

FDTLF   IF E                   DISK

C                EXFMT          DSPF01

C                DOW            NOT *INKA

C  IDNO      CHAIN          DTLF01    

C               EXFMT          DSPF01

C               ENDDO

C              SETON                                    LR

C             RETURN

********************************************************

DDS SPECIFICATION FOR DIPLAYFILE(DSPF01)

A                                                       DSPSIZ(24 80*DS3)

A                                                       CF03(03'EXIT')

A                                  8 12 'IDNO:'

A       IDNO       R      I  8 20REFFLD(DTLF01/IDNO PERAJ/DTLF)

A      PDATE      R      O  9 20REFFLD(DTLF01/PDATE PERAJ/DTLF)         

  ******************************************************

 THE PROGRAM RETRIEVES THE DATE FOR THE SPECIFIC IDNO  ENTERED AT THE DISPLAY FILE FROM THE DTLF PHYSICAL FILE WHICH HAS TWO FIELDS IDNO AND PDATE.KINDLY TELL ME WHAT IS WRONG OR GIVE ME SUGGESTIONS FOR DOING THIS TASK USING DATABASE FIELDS IN THE DISPLAYFILE.ALSO GIVE ME SOME INTERACTIVE EXAMPLE PROGRAMS INVOLVING DISPLAYFILE ,PHYSICAL FILE..THANK YOU



Software/Hardware used:
I SERIES VERSION 5 RELEASE 3(V5R3),OS400

Answer Wiki

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

I see 2 thngs wrong. *INKA is the indicator for a cmd key 1 (CF01) not cmd key 3 (CF03). Further your DDS defines the response indicator 3 for your CF03 command key.

Try changing your do while loop to:
C DOW NOT *IN03

Discuss This Question: 8  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
  • philpl1jb
    Right With CF03(03) it's *IN03 Wiht CF03 it's *INKC .. CF01 would be *INKA, CF02 would be *INKB, etc Phil
    51,355 pointsBadges:
    report
  • Peraj
    Thanks ElTerrifico and Phil ,I got it cleared...its working fine now...but what happens exactly after the exfmt statement ,where is the IDNO stored and what happens during the chain operation...I could not still get the pdate for the entered IDNO in the displayfile..please give me some solution
    55 pointsBadges:
    report
  • Peraj
    My assumption about this program is after I enter the IDNO the exfmt statement passes the IDNo to the rpgle program and after the chain operation the keyed field IDNO with the particular IDNO is retrieved and displayed in the DSPF01...Am I right in my assumption..can somebody give me a explanation in this regard..Thank you..
    55 pointsBadges:
    report
  • ElTerrifico
    You're pretty much right on track. The EXFMT essentially performs 2 functions. First it writes the contents of the display file to the screen. Then after the user has entered their data and press enter or some other function key it reads the display file and passes the data from the screen back to the RPG program. The CHAIN operation retrieves the record specified by the IDNO field. You can add an IF %FOUND statement after the CHAIN to determine if you found a record. I think I do see another problem here. You need to put a K in position 34 of the F spec for DTLF. DLTF IF E K DISK The K signifies that you will be accessing the file with key values. By leaving that blank you are accessing the file by relative record number. What will happen is that you will access the record with the record number that you enter into IDNO and not the record with the key value IDNO. I hope this helps.
    620 pointsBadges:
    report
  • philpl1jb
    Typically, if you've successfully found the record you would show a second display with the data else you'ld show an error message highlighting the field on the first screen and indicating the error. Phil
    51,355 pointsBadges:
    report
  • Peraj
    Vow I got it Mr.ElTerrifico ,its functioning as expected when I placed a K in position 34 of the F spec.I perfectly understand the entire process now but I dont understand the concept of relative record numbers still ...for example the values stored in the DTLF be as below IDNO PDATE 3772 12/8/2009 3773 16/9/2008 4772 18/9/2009 so what do you mean by relative record numbers here,and when I entered 3772 with k in position 34 it is perfectly retrieving the PDATE but with out k what would have happened exactly.....Thanks a lot Elterrifico and Phil for taking time to answer my questions...
    55 pointsBadges:
    report
  • ElTerrifico
    You’re welcome Peraj. Happy to help. The relative record number (RRN) is simply the position (or record number) of the record in the file. (There are a few more subtleties, but that this is the basic concept.) The first record in the file is RRN 1, the second record is RRN 2, and so on. For the sample you supplied if they were the only 3 records in your file, the record with IDNO 3772 would be record number 1. When you put in 3772 without the K in the F spec, you were trying to access the 3772nd record in the file. If your file did not have that many records, the CHAIN would fail.
    620 pointsBadges:
    report
  • Peraj
    Thats perfectly understood Mr.ElTerrifico and your inputs were very constructive...looking forward to more help in the upcoming days....Thank you
    55 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