Posts

Showing posts from January, 2018

AS400 CL: Run a command in a target system from the current system

Below Command will submit a Command (here a job with Parameter) in the remote system where the PF file of the DDM file resides. The job will be submitted with the users default jobd. QGPL/TSTJOBD gets overidden. To run this command you need to a file (Lets say SYS2) in the target system and a DDM file (RUSYS2 for that file SYS2 in target system) in the source system for that file. The command has no separate parameter for the remote system information; it know the command has to run in the system where the PF file of the DDM file is. In this case SYS2 PF resides in SYSTEM2 and RUSYS2 DDM file resides in SYSTEM1. This command will the run in SYSTEM1 will submit the job to call TSTLIB/PGMEML in SYSTEM2   SBMRMTCMD CMD('SBMJOB CMD(CALL PGM(TSTLIB/PGMEML) PARM(''DUMMY@XEMAIL.COM'')) JOBD(QGPL/TSTJOBD)') DDMFILE(TSTLIB/RUSYS2)                      

AS400 CL PGM Send a message to QSYSOPR and get reply from user to perform a process

PGM DCL &MSGKEY  *char     4                                DCL &RPLY     *char     1   ' '                                                                                      SNDPGMMSG MSG('Dont have enough Space. Type Y after clear some space or N to stop prcess (Y/N)') +               KEYVAR(&MSGKEY) MSGTYPE(*INQ)  TOMSGQ(QSYSOPR)                                                             RCVMSG MSGTYPE(*RPY) MSGKEY(&MSGKEY) WAIT(*MAX) MSG(&RPLY)                                                                  if (&RPLY = 'Y') do                                            sndpgmmsg 'Program Continue' Enddo   if (&RPLY = 'N') do                                            sndpgmmsg 'Program Stopped' Enddo ENDPGM

AS400 : Add a new line in text in email SNDSMTPEMM

Declare  ** NAMED CONSTANTS FOR CARRIAGE RETURN  Which will move the control to next line                      D CR              C                   CONST(X'0D')                  //0->Zero D vSepj           S              1    Inz('/')   D vQot            S              1    INZ('''')  DRunCommand       PR                  extpgm('QCMDEXC')                D pCommand                    2560    const                            D pCmdLength                    15  5 const                            D pCommand        S           2560                                     D pCmdLength      S             15  5 inz(2560)                        pComdse  = 'SNDSMTPEMM RCP(' + %Trim(vpToAdr) + %Trim(vpCcAdr) +                       %Trim(vpBccAdr)  + ') SUBJECT(' +                                            %Trim(vpSubject) + ')';        vpContent = ‘TEST’;                      vpContent = %Trim(vpConten

Pass Parameters more than 32 byte in SBMJOB command using RQSDTA

Variable greater than 32 byte length will be truncated to 32 byte (including the trailing spaces) when a call command is submitted using SBMJOB CMD(CALL PGM(*LIBL/PGM1) PARM( &ERROR & USER ....) Since you are trying to pass the value of a variable to another job from your interactive job environment but the other wont share the same environment hence the variable values are not accessible. hence these values are sent as values to another job and the default length is 32 per variable in CMD. When your RPG/CL/CBL program get these variable the Error will have 32 byte of Error and then the 32 of User and so on (result in undesirable effect). One way to do it put a limiter value at the end of each variable so there is no trailing spaces, but the best way to do that is instead using SBMJOB CMD(CALL PGM(*LIBL/PGM1) PARM( &ERROR & USER ....)  use SBMJOB RQSDTA(CMDV) Example shown below (CL Program) but similar can be done in RPG or COBOL build the command string and ad