Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

18/09/2K14

the maximum number of joins that can be performed IS_31______.


The number of record formats that can be maintained in a physical file are one record format.
The number of record formats that can be maintained in a logical file are 32 record format.
The difference between packed and zoned decimal are the memory consumption is half in the
packed decimal and full storage is used in zoned decimal.
Illustration
5P0–
5- length
P – packed data type
0-decimal.
Here in this case we have a memory comsumption of 5/2 .i.e 3 bytes and its 5 bytes for zoned.
To find the number of fields DSPFFD.
To find the number of logical files associated with any physical file we have DSPDDR.
TO VIEW
1. Runqry command always run the file in arrival sequence.
2. STRSQL (Using the select command).
TO VIEW in key sequence we need to write a RPG program.
RPG
Introduction
Variable is termed as field having name ,length and data type. Master file in general will have
the unique details . All the transaction file doesn’t have the unique details and they are a track
record of things that happen from time to time. Values which we enter into the fields become
records which are nothing but collection of fields.
PROGRAM DEVELOPMENT CYCLE
In column dependent source all the values have to be entered in the corresponding columns
(used in DB2) whereas in the free format source the values could be entered
everywhere(used in RPG).
RPG IV SPECIFICATIONS
F,D,I,C,O,P
F- FILE DESCRIPTIONS (files to be used in the program)
D- DEFINITION (variable,constant,array)
I – INPUT (details of the files, record format)
C – CALCULATION (all the logics)
O – OUTPUT (to create the report).
H- HEADER
P – PROCEDURES.

MYFIRST PROGRAM IN RPGLE


CRTSRCPF QRPGLESRC
STRPDM
Create a member SPARTANS
Specify the record length 112
Specify the file as RPGLE
OPCODES:
C >OPERATION FACTOR1
DSPLY ‘SPARTA’
C >OPERATION FACTOR2
EVAL *INLR=’1’
/* The INLR indicates the last record ==1 shows that it is the last record .it is similar to setting
flags in programming*/
COMPILE THE PROGRAM
Enter C In The Option Box To Run The Program Once The Program Is Submitted To The Library.
FILE DESCRIPTION SPECIFICATIONS
- File name
- File type (INPUT, OUTPUT , UPADATE , C-DISPLAY).
- File designation(PRIMARY , SECONDARY , R, T, F)
- File format(F ,E)
- Records
- Device.(FOR PF AND LF –DISK , SCREEN – WRKSYS).
1.How to retreive ONE record from logical file using RPGLE.
Create a member in QRPGLE
OPCODES:
F >FILENAME FILETYPE FILE DESIGNATION FILE
FORMAT DEVICE ADD.TY
CEMPL I F E DIS
K K
C >OPERATION FACTOR1 FACTOR2
SETLL *LOVAL CEMPL
/*To set the position from which the records has to be fetched*/
/*LOVAL is a figurative constant setting the lower value*/
C >READ FACTOR2
CEMPL
C >OPERATION FACTOR1
DSPLY EMPNO
C >OPERATION FACTOR2
EVAL *INLR=’1’
COMPILE THE PROGRAM
TO DEBUG:
SHIFT F3
THEN SELECT THE PROGRAM FROM THE LIST BY PROMPT.
SELECT THE LAST SPOOL FILE.
2.How to retreive ALL records from logical file using RPGLE.
Create a member in QRPGLE
OPCODES:
F >FILENAME FILETYPE FILE DESIGNATION FILE
FORMAT DEVICE ADD.TY
CEMPL I F E DIS
K K

C >OPERATION FACTOR1 FACTOR2


SETLL *LOVAL CEMPL
/*To set the position from which the records has to be fetched*/
/*LOVAL is a figurative constant setting the lower value*/
C >READ FACTOR2
CEMPL
C >DOW NOT%EOF(CEMPL1)
/*% - SHOWS THAT IT IN A BUILT IN FUNCTION. NOT THE END OF RECORD OF CEMPL1*/
C >OPERATION FACTOR1
DSPLY EMPNO
READ CEMPL1
ENDO
*
C >OPERATION FACTOR2
EVAL *INLR=’1’
INPUT AND OUTPLUT SPECIFICATION
To rename the fields FOR I/P PEC. To define the layout of the printer or spool files.
TO WRITE A FREE FORMAT CODE
Always write the program in C spec
Starting with /FREE and ending with /END-free.
Printer files can be external or can be programmed within the program. They are called
program defined printer files. PROGRAMS DESCRIBED
OPCODES:
F >FILENAME FILETYPE FILE DESIGNATION FILE
FORMAT DEVICE ADD.TY
CEMPL I F E DIS
K K

FILENAME FILETYPE FILE FORMAT RECORD LENGTH DEVICE


QPRINT O F 132 PRIN
TER
C >OPERATION FACTOR1 FACTOR2
SETLL *LOVAL CEMPL
/*To set the position from which the records has to be fetched*/
/*LOVAL is a figurative constant setting the lower value*/
C >READ FACTOR2
CEMPL
C >DOW NOT%EOF(CEMPL1)
/*% - SHOWS THAT IT IN A BUILT IN FUNCTION. NOT THE END OF RECORD OF CEMPL1*/
C >OPERATION FACTOR1
DSPLY EMPNO
READ CEMPL1
ENDO
*
C >OPERATION FACTOR2
EVAL *INLR=’1’
To design a layout
VARIABLE DECLARATION:
D- DEFINITION SPECIFICATION
TYPE – S- STANDALONE VARIBALE
LENGTH-5
DECIMAL POSITIONS -0

You might also like