How can i check the object existance in RPG program without
using QCMDEXC command.
Answers were Sorted based on User's Feedback
Answer / syam
Without using QCMDEXC.
RPG Free format
Dsply ' File not found'
|Is This Answer Correct ?||13 Yes||1 No|
Answer / keshar jain
In addition to above answers with MONITOR we can check for mesage CPF9801. It will give clear idea about object existence.
|Is This Answer Correct ?||3 Yes||0 No|
Answer / roshan.wankar
1. To check File object, you should defined file in User
open mode and by using %Open operation we can identify the
file object is present or not.
2. To check Program object,
Use MONITOR; opcode or in calling specify low indicator, if
Low indicator is On, means object is not present in library
|Is This Answer Correct ?||2 Yes||0 No|
Answer / naveen chandra joshi
The question is:
How can i check the object existence in RPG program without
using QCMDEXC command?
Answers posted by AS/400 experts:- use Monitor On error; what if file is not in user opened mode and already declared & opened in F specs...this solution will not work in this case and program will throw error when it tries to open the file in F specs itself...(This we can solve using File Information DS)
User wants to know the object existence, it (object)can be file object, program object or any other type of object.
Generally we check object existence by using CHKOBJ command but user said not to use QCMDEXC API...
The solution is(by using QUSROBJD API):
*---------- Global variables: ----------------------*
D ObjNam s 10a
D ObjLib s 10a
D ObjTyp s 10a
*---------- Api error data structure: --------------*
D ApiError Ds
D AeBytPro 10i 0 Inz( %Size(ApiError))
D AeBytAvl 10i 0 Inz
D AeMsgId 7a
D AeMsgDta 128a
*-- Retrieve object description: -----------------------*
D RtvObjD Pr ExtPgm('QUSROBJD')
D RoRcvVar 32767a Options(*VarSize )
D RoRcvVarLen 10i 0 Const
D RoFmtNam 8a Const
D RoObjNamQ 20a Const
D RoObjTyp 10a Const
D RoError 32767a Options(*VarSize)
C Eval ObjNam = '???'
C Eval ObjLib = '*LIBL'
C Eval ObjTyp = '*PGM'
C CallP RtvObjD( RoData
C : %Size( RoData )
C : 'OBJD0100'
C : ObjNam + ObjLib
C : ObjTyp
C : ApiError
C If AeBytAvl > *Zero And
C AeMsgId = 'CPF9801'
*-- Object doesn't exist...
|Is This Answer Correct ?||1 Yes||3 No|
Answer / mithila
In RPG4, QusRtvObjd API can be used which has procedutrs
like ChkObj and ChkMbr. or a CL program can be called that
checks the existence of object and returns some indicator
to for found/not found.
|Is This Answer Correct ?||3 Yes||7 No|
Answer / gagandeep kaur
I think using PSSR is also correct.
|Is This Answer Correct ?||1 Yes||5 No|
Answer / syam
|Is This Answer Correct ?||2 Yes||9 No|
What hapens when we use CPYF command to copy a LF? On which PF will it be dependent???
why subproc not run in dftactgrp?????/plz explain
what is use of sflnxtchg and use of MDT(modify data tag).both r same r not and can we use these on dspf and subfile.
Set on command is used for closed all opened files , initialize var and release resource , return cmd is used for return to calling program but my req. Is dnt close opened files and resource must released while doing transactions , how can i do this...?
As400 Command to find the Name of the Program to which a Particular Module is Bound..? Ex: IC210AMR (*MODULE) is bound with Other Modules which Forms Program Object as IC210ABP(*PGM) . As400 Command to find the IC210ABP Using IC210AMR..? Thanks
Why Rpg/400 is Famous?
How many program bind in one module....
i 'm new to as/400.in an interview i was asked this question.give a practical example for passing information or data through local data area. I know only that data area is an object used to store tiny bits of data or it can store one value at a time and it is used to store frequently changing values or datas.thats all i know about data area can any one tell me how local data area and user defined data area are used to pass data between jobs with a example or coding.thanks in advance.
How to print output from openquery in as400 ?
can you debug ile rpg program using isdb?
Difference between RESET and CLEAR
in a cl pgm records are copied to a file in qtemp a pgm is called to delete records from the file in qtemp no of records in file in library qtemp is checked wat shud be the count of records let say it was 10 initially endpgm