Posts

IBMi (AS400) fans only - RPG Free. Minimalist program with a single video format

Image
  #IBMiSample Remember that you need my CLANA00F file to compile the following program. So, f irst of all look at this post and compile and populate these files to use this example. A01ARPCL.CLP              PGM                                                              DCL        VAR(&PPCCL0) TYPE(*DEC)   LEN(7 0)                    DCL        VAR(&PPEXIT) TYPE(*CHAR)  LEN(1)                      DCL        VAR(&OUTPU1) TYPE(*CHAR)  LEN(1)                      DCL        VAR(&OUTPU7) TYPE(*CHAR)  LEN(7)                      DCL        VAR(&OUTPU8) TYPE(*CHAR)  LEN(8)                      CALL       PGM(A01ARP) PARM(&PPEXIT &PPCCL0)                     CHGVAR     VAR(&OUTPU1) VALUE(&PPEXIT)                           CHGVAR     VAR(&OUTPU7) VALUE(&PPCCL0)                           CHGVAR     VAR(&OUTPU8) VALUE(&OUTPU1 *CAT &OUTPU7)              SNDPGMMSG  MSG(&OUTPU8)                                          ENDPGM         

IBMi (AS400) fans only - How to store passwords in a secure way in a DB2 SQL Server database

Image
#IBMiSample This is a wery simple way to store passwords in a secure way in a DB2 SQL Server database. First of all create a table with only two fileds, user (UTENTE), and password (PWD). CREATE TABLE A01AWPWD (UTENTE varchar(128), PWD VARCHAR(124) FOR BIT DATA) Establish an encryption key. My encryption key for this example is skjdjuiu%Tr&$*+[be%_tr=\? Fill the table with users and passwords: INSERT INTO A01AWPWD (UTENTE, PWD) VALUES ('User01', ENCRYPT('Passw01', 'skjdjuiu%Tr&$*+[be%_tr=\?'))          INSERT INTO A01AWPWD (UTENTE, PWD) VALUES ('User02', ENCRYPT('Passw02', 'skjdjuiu%Tr&$*+[be%_tr=\?')) INSERT INTO A01AWPWD (UTENTE, PWD) VALUES ('JohnS', ENCRYPT('ert%9ii', 'skjdjuiu%Tr&$*+[be%_tr=\?')) Now we have a table A01AWPWD with ENCRYPTED passwords. Try this: SELECT PWD  FROM A01AWPWD  WHERE UTENTE = 'JohnS' As you can see, the password is ENCRYPTED. To read  (DECRYPT) the  passwords y

IBMi (AS400) fans only - How to print with a externally described printer file

Image

IBMi (AS400) fans only - How to add an HELP panel (Minimalist example) to a DSPF - HELP - ALTHELP - HLPARA - HLPPNLGRP

Image
  #IBMiSample This is the PANEL source. Compile with  CRTPNLGRP PNLGRP(MyLib/PNLGR1) SRCFILE(MyLib/MySrcFile) SRCMBR(PNLGR1)   Member      Type   PNLGR1      PNLGRP .*********************************************************** .*    THIS IS HELP PANEL GROUP FOR HOTELIBMi               * .*********************************************************** :PNLGRP.                                                      .***********************************************************  .*    THIS IS HELP PANEL OTO500                            *  .***********************************************************  :HELP NAME=OTO500.Print arrivals Help panel                   :P.This is a example help text                                :P.This is another example help text                          :EHELP.                                                       .***********************************************************  .*    THIS IS SINGLE FIELD HELP PANEL                      *  .*******************************

IBMi (AS400) fans only - How to add/subtract days to a date from CL (CONTROL LANGUAGE)

Image
#IBMiSample This is a CLLE! Compile with: CRTBNDCL PGM(DATEDISPLC) SRCFILE(QCLSRC) SRCMBR(DATEDISPLC) DATEDISPLC.CLLE /**************************************************************/ /* add/subtract days to a date                                */ /* Try with: CALL DATEDISPLC PARM('270219' X'0000005F')       */ /**************************************************************/              PGM        PARM(&DATE &DISPLACEM)                                   DCL        VAR(&DATE) TYPE(*CHAR) LEN(6)                            DCL        VAR(&DISPLACEM) TYPE(*DEC) LEN(6 0)                      DCL        VAR(&LILIAN) TYPE(*CHAR) LEN(4)                                                                                              CALLPRC    PRC(CEEDAYS) PARM((&DATE) ('DDMMYY') +                                (&LILIAN) (*OMIT))                                     CHGVAR     VAR(%BIN(&LILIAN)) VALUE(%BIN(&LILIAN) + +                   

IBMi (AS400) fans only - HOW TO GET CURRENT TIME FROM CL (CONTROL LANGUAGE)

Image
#IBMiSample This example gets current time in format HHMMSS.              PGM                                                   DCL        VAR(&TIME) TYPE(*CHAR) LEN(6)              RTVSYSVAL  SYSVAL(QTIME) RTNVAR(&TIME)                SNDPGMMSG MSG(&TIME)                                  ENDPGM                                  

IBMi (AS400) fans only - How to get today's date from CL (Control Language)

Image

IBMi (AS400) fans only - Fully Free RPG: Procedure with a parameter and return value

Image
#IBMiSample AS5502.RPGLE - Procedure with a parameter and return value       **FREE          Ctl-Opt DFTACTGRP(*No);          Dcl-S gMyVar Char(13) Inz('<---Hello--->');          Dcl-S pValue2 Char(3);          Dcl-S pValue3 Char(3);          Dsply gMyVar;          pValue2='!__';          pValue3='__!';          gMyVar = MyProc('Goodbye':pValue2:pValue3);          Dsply gMyVar;          *InLR = *On;        Return;        Dcl-Proc MyProc;          Dcl-Pi *N Char(13); // Char(13) the length of returned                                   // parameter. It is like gMyVar Char(13)          pValue1 Char(7) Const;          pValue2 Char(

IBMi (AS400) fans only - QSQGNDDL API: How to get SQL SOURCE specification from a database object

Image
#IBMiSample QSQGNDDL API generates the SQL data definition language statements from a database object. Here's how to use it. How to get SQL CREATE TABLE specification from DDS

IBMi (AS400) fans only - Reverse date 6 0 in one instruction

Image
#IBMiSample In this example, the  OTDTP0  field is numeric 6 with 0 decimal places. It should contain a number rapresenting a DATE in yymmdd (i.e 210208 - February 8, 2021) or ddmmyy format  (i.e 080221 - February 8, 2021). The following instructions turns yymmdd to ddmmyy or viceversa (the other way around). OTDTP0 zoned(6); OTDTP0 = %dec(%char(%date(OTDTP0:*ymd):*dmy0):6:0); // yymmdd to ddmmyy OTDTP0 = %dec(%date(OTDTP0:*ymd):*dmy);  // yymmdd to ddmmyy I appreciate all the comments made on this blog.

IBMi (AS400) fans only - Fully Free RPG get Today's date with a single instruction

Image

IBMi (AS400) fans only - Fully Free RPG: Example to get day of week

Image

IBMi (AS400) fans only - Fully free RPG: minimalist SUBFILE example

Image

IBMi (AS400) fans only - Fully Free RPG: Single Page Subfile SQLRPGLE Example Program

Image

IBMi (AS400) fans only ' My files for all my examples:

Image
#IBMiSample Run this SQLRPGLE to create and populate the files to use my further examples: **free //***************************** //* create CLANA00F & OTORD00F* //***************************** ctl-opt option(*nodebugio) dftactgrp(*no) actgrp(*new); // The EXEC SQL is never executed. It is used at compile time. exec sql Set Option Commit = *None; // Create File exec sql CREATE or REPLACE TABLE CLANA00F ( CLANN0 CHARACTER(01) NOT NULL WITH DEFAULT, CLCCL0 NUMERIC(7, 0) GENERATED ALWAYS AS IDENTITY PRIMARY KEY, CLCIB0 CHARACTER(03) NOT NULL WITH DEFAULT, CLNOM0 CHARACTER(50) NOT NULL WITH DEFAULT ) RCDFMT CLANA ; // Create index exec sql CREATE INDEX CLANA01L ON CLANA00F (CLCCL0 ASC); // Fill values exec sql INSERT INTO CLANA00F (CLCIB0, CLNOM0) VALUES ('EN ','Rod Stewart'); exec sql INSERT INTO CLANA00F (CLCIB0, CLNOM0) VALUES ('EN ','Bobby McFerrin'); exec sql INSERT INTO CLANA00F (CLCIB0, CLNOM0) VALUES ('IT ','Adriano Celentano'); e