ctl-opt option(*nodebugio:*srcstmt) dftactgrp(*no); ctl-opt actgrp('PIO'); // ---------------------------------------------------------- // // Developed for: Demonstration Purpose // // Author : Adarsh // // Date : 08/28/2023 // // Description : Get the production user profile and // // encrypted password and call the profile // // handling CL program-SETPHPRD // // // // ---------------------------------------------------------- // // Prototype declaration.. dcl-pr thispgm extpgm('SETPHPRDR'); end-pr; dcl-pi thispgm; end-pi; dcl-pr profileHandling extpgm('SETPHPRD'); userid char(10); pass char(10); passLen int(3); end-pr; // Standalone variable declaration.. dcl-s CurrUser char(10) inz; dcl-s userid char(10) inz; dcl-s pass char(10) inz; dcl-s passLen int(3) inz; dcl-s pslen bindec(3) inz; dcl-s encKey varchar(10) inz('Adarsh'); dcl-s text char(150) inz; dcl-s cmd char(1000) inz; dcl-s cmdlen zoned(4) inz; // set compiler option.. exec sql set option commit = *none, closqlcsr = *endmod; // Start main.. exsr getProdProfilePassword; if pslen > 0; profileHandling(userid : pass : passLen); endif; // End main.. *inlr = *on; // ------------getProdProfilePassword--------------- begsr getProdProfilePassword; exec sql set :CurrUser = session_user; cmd = 'CHGJOB CCSID(37)'; cmdlen = %len(%trim(cmd)); exec sql call qcmdexc(:cmd, :cmdlen); exec sql select PRODPRF, DECRYPT_BIT(ENCPASS, :encKey) into :Userid, :Pass from SETPHPRDP where usernm = :CurrUser and status = 'A'; exec sql get diagnostics condition 1 :text = message_text; psLen = %len(%trim(pass)); exec sql set :passlen = integer(pslen); endsr;