How can i check the object existance in RPG program without
using QCMDEXC command.
Answer Posted / 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 1a
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 )
*
C If AeBytAvl > *Zero And
C AeMsgId = 'CPF9801'
*-- Object doesn't exist...
C EndIf
*
C Return
Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
what was the robotech rpg?
which program rpg or cl is efficent to update a transaction onto a database file and why ?
Suppose we have one database file and it is used by 5 programs and in 3 program we have to add some records in datbase file s what is the impact on other program?
give an eg of ACQ-(ACQUIRE),BIT OFF,BIT ON,DEALLOC,DUMP,FEOD,FORCE,MHHZO,MHLZO,MHLLZO,MLHZO,REL,RESET,TESTZ,TESTB,TESTN----GIVE SMALL EXAMPLE TO THE OPCODES...TO UNDERSTAND FUNCTIONING...........
If my rpg program has a date field, what extra care I have to take while compiling that rpg program? If the file is keyed and I have declared the file as well as key list properly in my program. Still am getting an error message like "chain/reade operation is not allowed" what may be the case?
What is file identifier where we can use?
how do I play {insert rpg system here}?
What is the purpose of record level identifier?
what is a rpg?
Q:HI friends accually ihave one problem plesase let me know the alternate code of this code. Related field description of code: Add a field, CALvsPRD, "Calendar Day Starts Before/After Production Day" to the parameter set WRKORDER which accepts values 'A' or 'B' o B = Calendar Day Starts Before Production Day o A = Calendar Day Starts After Production Day o Any other value indicates the production and calendar dates are always the same. code: Automatic Execution Of *INZSR Subroutine /Z01 * retrieves WRKORDER field values. /Z01 * Calculate default Production Date and return it to caller. /Z01 * Production date defaults to system date /Z01 C Eval P@Pdate = %DATE() /Z01 * unless Calendar date starts Before PDN(production) date and /Z01 * system time is before PDN Start Time then /Z01 * PDN date is yesterday. /Z01 C If W@CALvsPRD = 'B' and /Z01 C %TIME() < %TIME (W@Strtime) /Z01 C Eval P@Pdate -= %Day(1) /Z01 * unless Calendar date starts After PDN date and /Z01 * system time is *GE PDN(production) Start Time then /Z01 * PDN date is tomorrow. /Z01 C ElseIf W@CALvsPRD = 'A' and W@Strtime > *Zero and /Z01 C %TIME() >= %TIME (W@STrtime) /Z01 C Eval P@Pdate += %Day(1) /Z01 C EndIf /Z01 C Eval *InLr = *On
during execution, an rpg/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps.
what is the rpg system?
What is a record lock error?
are there any useful c runtime apis that I can call from rpg iv?
Assume 2 users are using the same file and first user updates some record in the file. Will the 2nd user will be able to see the updated record or not?