when will come session device error?

Answers were Sorted based on User's Feedback



when will come session device error?..

Answer / katiyar

As I mentioned above RRN (Relative Record Number) may be a
cause of "Session and Device Error". So In program code, at
display(EXFMT) subfile code, check the value of RRN. If is
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.So to avoid this situation you can
code in the way it mentioned below.

C If (RRN <= *Zeros)
C Eval *In32 = *OFF
C Else
C Eval *In32 = *ON
C EndIf

Where *In32 is SFLDSP indicator in Subfile code.

------------------OR-------------------
C If (RRN > Zeros)
C EXFMT SFLCTL (Subfile Control Display)
C EndIf

Both ways can be choose to avoid RRN related error.
==========================================================
Except the RRN, There are literally hundreds of other things
that can cause a "session or device error," and each has
exactly one "right" solution.For e.g. there may be chances
that you have not declared the keyword 'SFILE' i.e
SFILE(subfile rcdfmt name : RRN) while declaring
display(subfile) file in F-specs of your program. If so then
one can get the "session or device error".

Therefore, when you get a "session or device error," look at
the job log. In the job log will be a message that will
tell you exactly what the problem is. And also understand
all in better way, one should understand subfile programming
first.

Is This Answer Correct ?    14 Yes 0 No

when will come session device error?..

Answer / katiyar

The Session and Device error occurs when program tries to
load data to display file (Subfile). The program should have
correct logic to load data from Database file to Subfile
using RRN(Relative Record Number). Then only data will be
loaded successfully to display file (subfile) else it will
be encountered with session and device error.

To prevent Session and Device error, One should understand
the Display file (Subfile) programming.

Is This Answer Correct ?    11 Yes 3 No

when will come session device error?..

Answer / raj

1. If RRN is not incresing correctly
2. If sfldsp and sfldspctl are set on proparlly
3. In load all if records exceeds 9999 and even less than
zero

Is This Answer Correct ?    2 Yes 1 No

when will come session device error?..

Answer / sahish

Check the records are write in sub file

write sfl

for each record

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More RPG400 Interview Questions

I have a RPG program of 100 Lines and first line is to SETON indicator LR. Will the program execute rest of the 99 Lines?

6 Answers  


1..Write an sql query to find the employee name who is having 2 phone numebr? 2.Write an sql query to the the second highest salary of the employee?

4 Answers  


can any body correct the following code? Following a procedure which returns the maximum of two numbers.Correct the following code. P GETMAX B D GETMAX PI D NUM1 35 0 D NUM2 45 0 C IF NUM1 > NUM2 C RETURN NUM1 C ELSE C RETURN NUM2 C ENDIF P GETMAX E

1 Answers  


I have some doubts on subfile----------- -----I wrote a prog on subfile to display the records. Every thing is clear but i defined a field called "opt" as input field in subfile record format from that input field i wish to enter into new screen called "EDIT" which i created it as a separate RCD in display file. i gave opt as 2 for edit just like in WRKMBRPDM screen please telll me the code and how can i code for it in RPG.

3 Answers  


what happens when sflsiz = sflpag? What are the advantages and disadvantages?

0 Answers   IBM,






Can a indexed file be accessed in arrival sequence in RPG?

1 Answers  


Can more than one subfile record be displayed on one line?

7 Answers   IBM,


This is my Physical file 'EMPS' existing in library "TAMIL1" and its record format is 'EMPRCD" a)its source is R EMPRCD ENO 4 0 ENAME 10 EADD 10 b)The records present in EMPS are as follows ENO ENAME EADD 0001 tamil coimbatore 0002 kumar bangalore 0003 sunder bangalore 0004 arunkumar chennai 0005 pandi hyderabad 0006 santhosh hyderabad 0007 sasi salem 0008 kalai chennai 0009 suresh hyderabad 0010 vijay bangalore 0011 Arul chennai 0012 velu chennai 0013 khan bangalore 0014 praba chennai 0015 praba.p coimbatore 0016 anand ooty 0017 raja erode 0018 sankar erode 0019 vadivel namakkal 0020 anbu chennai 0021 Ajith mumabi c)now i want to select the 'ENAME' field records starting with 'S' for that i have created a RPG program its source code is PGM DCLF FILE(TAMIL1/EMPS) DCL VAR(&MYENO) TYPE(*CHAR) LEN(4) OVRDBF FILE(EMPS) SHARE(*YES) OPNQRYF FILE((TAMIL1/EMPS)) QRYSLT('ENAME *EQ %WLDCRD("S *")') READ: RCVF RCDFMT(EMPRCD) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) CHGVAR VAR(&MYENO) VALUE(&ENO) SNDUSRMSG MSG(&MYENO) SNDUSRMSG MSG(&ENAME) SNDUSRMSG MSG(&EADD) GOTO READ END: CLOF OPNID(EMPS) DLTOVR FILE(EMPS) ENDPGM Is this coding correct sir,the program gets compiled,and if i call it it says query running but records are not displayed.please help me out

4 Answers   Virtusa,


How to set on/off a group of indicators in a single statement?

3 Answers  


how does the rpg element work?

0 Answers   IBM,


How to identify the object has compiled with the debug view as *source without using STRDBG?

6 Answers  


How to get only unique records from a file which contains duplicate data using CPYF command ? Example : FILEA has duplicate records and FILEB is a UNIQUE defined.... and I want to get the data from FILEA to FILEB by eliminating all the duplicate records...

2 Answers  


Categories