Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
I have a requirement to create a CL program that cannot be called from the command line. It will be called from a java portlet by users that have authority, but no one can call it from a command line. I have no idea how to pull that off. Anybody?
Don't think you can prevent the CALL, except by security. But if you had something you could test, that could tell the difference between call rom Java portlet and call from command line, you could return without doing anything. Maybe interrogate the call stack (QWVRCSTK)?
If called from Java client, Client Access, PHP, etc. I believe the job type will be '0' (batch) and the subjob type would be 'J' (prestart job). Add edits to the CL program and exit if not that condition. Also *PUBLIC *EXCLUDE obviously on the object authority.
DCL VAR(&Type ) TYPE(*CHAR) LEN(1)
DCL VAR(&SubType ) TYPE(*CHAR) LEN(1)
RTVJOBA TYPE(&TYPE) SUBTYPE(&SUBTYPE)
If ( &TYPE *NE '0' *OR &SUBTYPE *NE 'J') THEN(RETURN)
Ringer