Ü Session or device error
Below
are the situations which can lead to session or device error:
·
Incorrect record number in
subfile SFLRCDNBR or SFLSIZ field.
·
In program code, at display (EXFMT)
subfile code, check the value of RRN. If
is zero and you are making on the SFLDSP indicator *ON or it is un-conditional
and doing display subfile. Then it will give you the same error.
·
Trying to show empty subfile.
·
Field and position in Display
file DDS is not correct.
·
The keywords are not properly
organized in Display file DDS.
·
Trying to write more than 9999
record on the Display file for Load All subfile i.e.
Example
Session or device error while
loading more than 9999 records in load-all subfile
Below are the steps to
simulate the session or device error situation:
a) First of all write a program to fill the PF with records more than 9999.
Physical file: REC11000PF
Columns . . . : 1 80 Browse AMIT/QRPGLESRC
SEU==> REC11000PF
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions+++++++++++++++++++++++++++
*************** Beginning of data ************************************************
0001.00
0002.00 A R REC
0003.00 A FLD01 05S 0
0004.00 A K FLD01
****************** End of data ***************************************************
b) Create a program to fill the physical file REC11000PF with 11000 records
Columns . . . : 6 80 Browse AMIT/QRPGLESRC
SEU==> REC11000
FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 FREC11000PFUF A E K DISK
0002.00 DI S 5 0
0003.00 C FOR I=00000 BY 1 TO 11000
0004.00 C EVAL FLD01=I
0005.00 C WRITE REC
0006.00 C ENDFOR
0007.00 C SETON LR
0008.00 *
0009.00 *
0010.00 *
****************** End of data *******************************************************
c) Create a display file to demonstrate the session or device error
Columns . . . : 1 80 Browse AMIT/QRPGLESRC
SEU==> REC9999DSP
FMT DP .....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++++++++++++++
*************** Beginning of data **********************************************
0001.00 A DSPSIZ(24 80 *DS3)
0002.00 A CA03(03 'EXIT')
0003.00 A R RECSFL SFL
0004.00 A S_FLD01 5 0B 07 20
0005.00 A R RECCTL SFLCTL(RECSFL)
0006.00 A SFLPAG(15)
0007.00 A SFLSIZ(9999)
0008.00 A 40 SFLCLR
0009.00 A 41 SFLDSP
0010.00 A 42 SFLDSPCTL
0011.00 A 45 SFLEND(*MORE)
0012.00 A RCDNBR 4S 0H SFLRCDNBR(CURSOR)
0013.00 A 01 25'TEST TO CHECK THE BUFFER OVERFLOW'
0014.00 A 05 20'FLD01'
0015.00 A DSPATR(HI)
****************** End of data **************************************************
d) Create the below Program to demonstrate the session or device error
Columns . . . : 6 80 Browse AMIT/QRPGLESRC
SEU==> REC9999RPG
FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 FREC11000PFUF A E K DISK
0002.00 FREC9999DSPCF E WORKSTN SFILE(RECSFL:RRN)
0003.00 DI S 5 0
0004.00 DRRN S 5 0
0005.00 C EVAL RCDNBR=9999
0006.00 C DOW *IN03=*OFF
0007.00 C 03 LEAVE
0008.00 C EXSR CLRSFL
0009.00 C EXSR FILSFL
0010.00 C EXSR DSPSFL
0011.00 C ENDDO
0012.00 C SETON LR
0013.00 *
0014.00 C CLRSFL BEGSR
0015.00 C SETON 40
0016.00 C WRITE RECCTL
0017.00 C SETOFF 40
0018.00 C ENDSR
0019.00 *
0020.00 C FILSFL BEGSR
0021.00 C FOR I=0001 BY 1 TO 9999
0022.00 C EVAL RRN=RRN+1
0023.00 C EVAL S_FLD01=I
0024.00 C WRITE RECSFL
0025.00 C ENDFOR
0026.00 C ENDSR
0027.00 *
0028.00 C DSPSFL BEGSR
0029.00 C SETON 4142
0030.00 C EXFMT RECCTL
0031.00 C SETOFF 4142
0032.00 C ENDSR
****************** End of data *******************************************************
OUTPUT
First loop of the
program leads to below output.
TEST TO CHECK THE BUFFER OVERFLOW
FLD01
9991
9992
9993
9994
9995
9996
9997
9998
9999
More...
Now we press Enter
and the DOW LOOP runs second time to produce Session or device error.
Because the 2nd
time value of RRN starts from 9999 as an initial value and when incremented by
1 leads to the below error.
Display Program Messages
Session or device error occurred in file REC9999DSP (C G D F).
Type reply, press Enter.
Reply . . ._________________________________________________
_______________________________________________________________
F3=Exit F12=Cancel