Posts

Showing posts with the label Fully free rpg

IBMi (AS400) fans only ' How to check a date field ddmmyy

Image
#IBMiSample How to check the correctness of a numeric date field 6 with 0 decimals. This program receives as input 1. a date in the DDMMYY format ( p_data ), for example p_data= 100612, that is June 10, 2012, an Error field ( p_error ). 2. a Flag field accepts date = 0 ( p_zero ). 3. returns a BLANK or 'E' value in the p_error field as a result of the check. CHKDATA.RPGLE       **free        ctl-opt option(*nodebugio:*srcstmt:*nounref) dftactgrp(*no)         ALWNULL(*USRCTL) ;         // Try with  STRDBG and         // CALL CHKDATA PARM(X'0120718F' 'x' 'N') valid date         // CALL CHKDATA PARM(X'0999999F' 'x' 'N') wrong date         // CALL CHKDATA PARM(X'0000000F' 'x' 'Y') no date, but it is allowed         // CALL CHKDATA PARM(X'0000000F' 'x' 'N') no date, it is not allowed         dcl-pi CHKDATA;           p_data packed(6);           p_error char(1);           p_zero  char(1);

IBMi (AS400) fans only ' Rpg Free Program Sample: How to manage a table through a program with two or more video formats

Image
#IBMiSample Typically we have a table and we need to perform read, write, update operations. This simple program is an example of how. First of all look at  this post  and compile and populate these files to use this example.

IBMi (AS400) fans only ' Minimalist Subfile with filter fields

Image
#IBMiSample First of all look at this post and compile and populate these files to use this example. Then compile the two following soures, OT08SF displayfile, OT08SF sqlrpg file. OT08SFV.DSPF                                             CHGINPDFT(CS UL HI)                                             INDARA                                             CA03(03 'F3=EXIT')                                             REF(OTORD00F)       *--------------------------------------------------------------                 R SFL1                      SFL       *--------------------------------------------------------------                   S1OPT          1A  B  6  2                   S1ANN0    R             +3REFFLD(OTANN0)                   S1COR0    R            + 1REFFLD(OTCOR0) EDTCDE(Z)                   S1NOM0    R            + 1REFFLD(CLANA/CLNOM0 CLANA00F)       *--------------------------------------------------------------                 R FMT01                     SFLCTL(SFL1)

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 - 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 - 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