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
ASKED:
December 8, 2009 3:17 PM
UPDATED:
December 11, 2009 9:50 AM
Right
With CF03(03) it’s *IN03
Wiht CF03 it’s *INKC .. CF01 would be *INKA, CF02 would be *INKB, etc
Phil
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
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..
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.
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
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…
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.
Thats perfectly understood Mr.ElTerrifico and your inputs were very constructive…looking forward to more help in the upcoming days….Thank you