Exploring the Program Status and File Information Data Structures _ ile rpg programming_ tips and techniques
Exploring the Program Status and File Information Data Structures _ ile rpg programming_ tips and techniques
Menu
For years programmers have been retrieving data assigned to physical Get Published! Submit
files, display files, ICF (Intersystem Communications Function) files, and original 'IBM i' articles to:
printer files in the form of the file information data structure. ile rpg publishing
Any fields that might be needed should be coded since if the field is not i links
included in the source then the information will not be available to the
program and will not be displayed in a formatted dump. If not sure then IBM's IBM i website
it is best to include any fields in question.
it knowledge exchange
First, with the program status data structure (SDS) the programmer planet-i blog aggregator
should be familiar, at a minimum, with the high-lighted fields in each
data structure. iSeries resources for
users and developers
D SDS
D PROC_NAME *PROC Procedure name
disclaimer
D PGM_STATUS *STATUS Status code
D PRV_STATUS 16 20S 0 Previous status Use the information
D LINE_NUM 21 28 Src list line nu found in this blog freely
D ROUTINE *ROUTINE Routine name in your applications.
D PARMS *PARMS Num passed parms However, the code
D EXCP_TYPE 40 42 Exception type presented herein is given
D EXCP_NUM 43 46 Exception number as sample code only and
D PGM_LIB 81 90 Program library must be thoroughly
D EXCP_DATA 91 170 Exception data tested by the
D EXCP_ID 171 174 Exception Id developer/end user. If
D DATE 191 198 Date (DATE fmt) you do not agree then
D YEAR 199 200S 0 Year (YEAR fmt) kindly refrain from using
D LAST_FILE 201 208 Last file used this code. THERE ARE NO
D FILE_INFO 209 243 File error info WARRANTIES OF ANY
D JOB_NAME 244 253 Job name KIND, IMPLIED OR
http://www.ilerpgprogramming.com/2010/11/exploring-program-status-and-file.html 1/5
6/29/2014 Exploring the Program Status and File Information Data Structures | ile rpg programming: tips and techniques
D USER 254 263 User name OTHERWISE.
D JOB_NUM 264 269S 0 Job number
D JOB_DATE 270 275S 0 Date (UDATE fmt)
D RUN_DATE 276 281S 0 Run date (UDATE)
D RUN_TIME 282 287S 0 Run time (UDATE)
D CRT_DATE 288 293 Create date
D CRT_TIME 294 299 Create time
D CPL_LEVEL 300 303 Compiler level
D SRC_FILE 304 313 Source file
D SRC_LIB 314 323 Source file lib
D SRC_MBR 324 333 Source file mbr
D PROC_PGM 334 343 Pgm Proc is in Donate page
D PROC_MOD 344 353 Mod Proc is in
D CURR_USER 358 367 Mod Proc is in privacy policy
advertising policy
Many legacy programs use the SDS to check the number of parameters If you like this site,then
being passed and one might wonder about whether this method will still link back to us:
function with prototyping parameters. Generally such older programs will
not need to be retrofitted but programmers should start relying on the http://www.ilerpgprogra
new built-in function %parms instead of *PARMS. mming.com/p/
home-page-index-of-all-
As stated in a previous article on this website; articles.html
"At times it is necessary to determine how many parameters are being passed
and the built-in function (BIF) %parm s can be used for this purpose. The
older method of coding a sy stem data structure SDS with the *PARMS field still
This work is licensed
works but is no longer necessary nor is it preferable going forward. It is
under a Creative
necessary to understand how parameters are passed with prototy ping and
Commons Attribution-
procedure interface specifications."
Noncommercial-Share
Alike 3.0 United States
Next, the file information data structure (INFDS) is divided into five License.
sections. These sections are called feedback areas and are, in order
of appearance, the File, Open, Input/Output, Device Specific, and the
"Get Attributes" feedback areas. For files the INFDS name must be
unique for each file.
The file information data structure (INFDS) looks like this (again the bold
font emphasizes basic familiarity is required):
DINFDS ds
D File *FILE * File name
D OpenInd 9 9 * File open?
D EOFInd 10 10 * File at eof
?
D FileStatus *STATUS * Status code
D OpCode *OPCODE * Last opcode
D Routinr *ROUTINE * RPG Routine
D ListNum 30 37 * Listing lin
e
D SpclStat 38 42S 0 * SPECIAL sta
tus
D RecordFmt *RECORD * Record name
D MsgID 46 52 * Error MSGID
D Screen_P *SIZE * Screen size
http://www.ilerpgprogramming.com/2010/11/exploring-program-status-and-file.html 2/5
6/29/2014 Exploring the Program Status and File Information Data Structures | ile rpg programming: tips and techniques
D ODP_TYPE 81 82 * ODP Type
D FILE_NAME 83 92 * File name
D LIBRARY 93 102 * Library name
D SPOOL_FILE 103 112 * Spool file name
D SPOOL_LIB 113 122 * Spool file lib
D SPOOL_NUM 123 124I 0 * Spool file num
D RCD_LEN 125 126I 0 * Max record len
D KEY_LEN 127 128I 0 * Max key len
D MEMBER 129 138 * Member name
D TYPE 147 148I 0 * File type
D ROWS 152 153I 0 * Num PRT/DSP rows
D COLUMNS 154 155I 0 * Num PRT/DSP cols
D NUM_RCDS 156 159I 0 * Num of records
D ACC_TYPE 160 161 * Access type
D DUP_KEY 162 162 * Duplicate key?
D SRC_FILE 163 163 * Source file?
D VOL_OFF 184 185I 0 * Vol label offs
D BLK_RCDS 186 187I 0 * Max rcds in bl
D OVERFLOW 188 189I 0 * Overflow line
D BLK_INCR 190 191I 0 * Blk increment
D FLAGS1 196 196 * Misc flags
D REQUESTER 197 206 * Requester name
D OPEN_COUNT 207 208I 0 * Open count
D BASED_MBRS 211 212I 0 * Num based mbrs
D FLAGS2 213 213 * Misc flags
D OPEN_ID 214 215 * Open identifie
D RCDFMT_LEN 216 217I 0 * Max rcd fmt le
D CCSID 218 219I 0 * Database CCSID
D FLAGS3 220 220 * Misc flags
D NUM_DEVS 227 228I 0 * Num devs defin
http://www.ilerpgprogramming.com/2010/11/exploring-program-status-and-file.html 3/5
6/29/2014 Exploring the Program Status and File Information Data Structures | ile rpg programming: tips and techniques
D DSP_TYPE_P 289 289 * Display type
D KBD_TYPE_P 290 290 * Keyboard type
D CTL_INFO_P 342 342 * Controller info
D COLOR_DSP_P 343 343 * Color capable?
D GRID_DSP_P 344 344 * Grid line dsp?
D* Printer
D CUR_LINE 367 368I 0 * Current line num
D CUR_PAGE 369 372I 0 * Current page cnt
D PRT_MAJOR 401 402 * Major ret code
D PRT_MINOR 403 404 * Minor ret code
D* Disk
D FDBK_SIZE 367 370I 0 * Size of DB fdbk
D JOIN_BITS 371 374I 0 * JFILE bits
D LOCK_RCDS 377 378I 0 * Nbr locked rcds
D POS_BITS 385 385 * File pos bits
D DLT_BITS 384 384 * Rcd deleted bits
D NUM_KEYS 387 388I 0 * Num keys (bin)
D KEY_LEN 393 394I 0 * Key length
D MBR_NUM 395 396I 0 * Member number
D DB_RRN 397 400I 0 * Relative-rcd-num
D KEY 401 2400 * Key value (max
D* * size 2000)
D* Display
D DSP_FLAG1 367 368 * Display flags
D DSP_AID 369 369 * AID byte
D CURSOR 370 371 * Cursor location
D DATA_LEN 372 375I 0 * Actual data len
D SF_RRN 376 377I 0 * Subfile rrn
D MIN_RRN 378 379I 0 * Subfile min rrn
D NUM_RCDS 380 381I 0 * Subfile num rcds
D ACT_CURS 382 383 * Active window
D* * cursor location
D DSP_MAJOR 401 402 * Major ret code
D DSP_MINOR 403 404 * Minor ret code
Also, some research into the major/minor error status codes (for
program and file exceptions) is time well-spent. An exception handling
subroutine INFSR can be specified on file specifications to assist with
error-trapping. Of course ON-ERROR works great in many situations
where some special processing is needed when an error occurs.
Home
http://www.ilerpgprogramming.com/2010/11/exploring-program-status-and-file.html 4/5
6/29/2014 Exploring the Program Status and File Information Data Structures | ile rpg programming: tips and techniques
Popular Posts
Using free format RPG IV
Basically all you need to add free format source code (calculation specs) to your RPG IV programs is the beginning "
/free " and ...
http://www.ilerpgprogramming.com/2010/11/exploring-program-status-and-file.html 5/5