You must be logged in to use the copy button.

        
**Free
ctl-opt
   copyright('Copyright JAS, Inc. 2024')
   nomain debug
   option(*srcstmt : *nodebugio ) ccsid(*char:*jobrun)
   decedit(*jobrun) alwnull(*usrctl);

//***********************************************************************************
//  PURPOSE: This application will execute CL command
// **********************************************************************************
//  COMPILE Module: CRTRPGMOD MODULE(*CURLIB/JSOBJEXIST) SRCFILE(*CURLIB/QRPGLESRC)
//                  SRCMBR(JSOBJEXIST) DBGVIEW(*SOURCE) REPLACE(*YES)
//  COMPILE SrvPgm: CRTSRVPGM SRVPGM(*CURLIB/JSOBJEXIST) EXPORT(*ALL) ACTGRP(*CALLER)
//  Bindding Dir:   ADDBNDDIRE BNDDIR(JASTOOL) OBJ((JSOBJEXIST))
// **********************************************************************************
/define Obj_Exists_PR
/copy qProtosrc,JSOBJEXIST

dcl-proc Obj_Exists export;

  /define Obj_Exists_PI
  /copy qProtosrc,JSOBJEXIST

  dcl-s Obj_Exists ind inz(*off);

  dcl-ds ds_ObjVar qualified;
    w_Var    char(99) Pos(1);
    w_Text   char(49) Pos(100);
    w_Src    char(30) Pos(150);
  end-ds;

  dcl-ds ds_Obj qualified;
    w_File char(10);
    w_Lib  char(10);
  end-ds;

  dcl-pr QUSROBJD  extpgm('QUSROBJD');
    objVar      char(180) options(*varsize);
    objVarLen   int(10)   const;
    ObjVarFmt   char(8)   const;
    OutFile     char(20)  const;
    ObjType     char(10)  const;
  end-pr;

// Main procedure *******************************************************************
  ds_Obj.w_File = p_Object;
  if %parms >= %parmnum(p_Library) and p_Library <> *blanks;
    ds_Obj.w_Lib = p_Library;
  else;
    ds_Obj.w_Lib = '*LIBL';
  endif;

  callp(e)  QUSROBJD(ds_ObjVar :%size(ds_ObjVar) :'OBJD0200'
                               :%upper(%trim(ds_Obj))
                               :%upper(%trim(p_Type)) );
  if %Error;
    Obj_Exists = *off;
  else;
    Obj_Exists = *on;
  endif;

  return Obj_Exists;
end-proc;