Working with non-database files
When you work with non-database files it is important to know that they concern the following cases:
Case 1 – Files existing as PF(38) or LF(38) but their structure is not detailed (contains just one or two large fields).
Case 2 – The application is in mode S36: the files have no DDS.
To work with this, you must first build the repository of PF36 fields.
The field lists in this case have PF36 as an attribute. This is a fictive attribute (this type doesn’t exist on the AS/400). It can concern the files not used in mode S36 (Case 1).
It is necessary to indicate Examine internal descriptions = *YES when running the propagation (in case 1).
In mode 36 only the following are managed (Case 2): RPG36, RPT36 and OCL36.
CBL36 is not managed in ARCAD Transformer Field.
Certain files concerned are also multi-format:
- The records are divided differently according to the value present in a position.
Command header if 0 is at position 20.
Command details if 1 is at position 20.
This case is managed by ARCAD Transformer Field but only if you have the possibility to know which format is used.
In RPG…, the format conditions (in card I) allow you to select an adequate division.
But, in the O cards and sometimes in Card I, these format conditions are absent as they are not required for the correct functioning of the program.
To ensure ARCAD Transformer Field operates correctly, it is necessary to add virtual format conditions in these programs, between the file name and the first field.
- Keyword (in comment) *%FMT in column 7 to 11 (In Card I or Card O).
- Format condition in the usual columns for this in RPG (or RPGLE) (Columns of Card I)
I Cards:
0025.00 0031 IF3601P1 NS 01 5 C2
0026.00 I 1 2 F1AA
0027.00 I 8 13 F1ZON1
0028.00 I 14 20 F1ZON2
0029.00 I 21 30 F1ZON3
0030.00 I NS 02 48NC
0031.00 I AND 5 C1
0032.00 I OR 48NCX
0033.00 I AND 5 C1
0034.00 I 1 2 F2AA
0035.00 I 8 13 F2ZON1
0036.00 14 20 F2ZON2
0037.00 I 21 30 F2ZON3
0038.00 I 31 35 F2DTE1
0039.00 36 41 F2DTE2
0040.00 0031 IF3601P1 NS 03 48 CV
0041.00 I OR 137 CL 48NCX 5 C1
0042.00 I 8 13 F3ZON1
0043.00 I 14 20 F3ZON2
0044.00 I 21 26 F3DTE1
0045.00 I/EJECT
0046.00 I 27 30 F3ZON3
0047.00 I 5 5 F3I005
0048.00 I 48 48 F3I048
0049.00 I 137 137 F3I137
0050.00 I*
0051.00 I NS 04
0052.00 I 8 13 F4ZON1
0053.00 I 14 20 F4ZON2
O Cards: addition of format condition lines recognized in ARCAD.
(with the I Card columns)
0155.00 OF3601P1 E
0156.00 O OR 18
0156.01 ===> *%FMT NS 01 5 C2
0157.00 O WAAA 2
0158.00 O W1ZON1 13
0159.00 O 20 ' '
0159.01 OF3601P1 E 20
0159.02 ===> *%FMT NS 03 48 CV
0159.03 ===> *%FMT OR 137 CL 48NCX 5 C1
0159.04 O O3ZON1 13
0159.05 O O3ZON2 20
0159.06 O O3DTE1 26
0160.00 O E 20
0160.02 ===> *%FMT NS 01 5 C2
0161.00 O WAAB 2
0161.01 O E 20
0161.02 ===> *%FMT NS 02 48NC
0161.03 ===> *%FMT AND 5 C1
0161.04 ===> *%FMT OR 48NCX
0161.05 ===> *%FMT AND 5 C1
0161.06 O O2AA 2
0161.07 O O2ZON1 13
0161.08 O O2DTE1 35
0161.09 O O2DTE2 41
0162.00 O*
0163.00 OF3602P1 E EXCPT2
0164.00 O*
You can build a list of non-DB fields by analyzing the internal descriptions contained in the RPG programs because there are no file descriptions. As there are no file descriptions, it is by analyzing the internal descriptions contained in the RPG… programs that you can build a list of non-D.B. fields.
The AFLDDCTS36
command allows you to run this analysis.
It gives an output list, LSTDBFS36 which contains all the fields of all the files found in the programs.
This command will attempt to extract the file descriptions from the RPG, RPGLE, RPG36 programs (or the /COPY). You can
-
You can start the analysis, then study the output list to verify the file names and the different formats for multi-format files.
Important!This list must be reliable. Don’t hesitate to modify the programs for the names of files in the programs (keyword
%EXEC
) or for the correct identification of formats (for multi-format files) (keyword%FMT
). - Redo the cross-references of modified programs.
- Then rerun the AFLDDCTS36 to see the improved list.
Contents of the LSTDBFS36 list in output from AFLDDCTS36
-
LST_JOBJ
– Field name: Fictive name PxxxxLzzzz (where xxxx is the starting position and zzzz is the occupied length)Positional reference to a file field.
-
LST_JSRCF
– Original file: actual name of file on disk (as the name in the RPG… is not reliable) (or external name defined in a %EXEC OVRDBF internal name/external name).Particularity: In mode 36, if a file name is partially expressed by a replacement variable in the OCL36, it is replaced by the character $; for the display name ?WS ?, the replacement is $_.
Example?02 ?.CLI gives $.CLI
?5?.CLI gives $.CLI (same file)
TEXT?WS? gives TEXT$_
-
LST_TDATE
– Numeric value 9999 then 9998, etc.… (one value per file).In
AEDTLST
andADSPLST
, this allows you to sort by date to obtain a sort by file(F14).(From now on, you can also carry out sorts with the filters in
AEDTLST
orADSPLST
.) LST_DAT
– Always 01/01/01LST_CATR
– Component attribute: PF36-
LST_JLIB
– Format: F01 by defaultIf the file is described with the format identifications coming from the positions in the RPG programs..., the format will be called:
- Fnnppppp where ppppp corresponds to the tested position, then C, then the compared character.
-
FnnFpppp where pppp is a sequential n° (if there is more than one comparison).
In both cases you find the format conditions at the beginning of the text field.
ExampleFormat 1: if position 12=1 and position 14=2 F01F0001 Text: 12C1&14C2
Format 2: if position 12=1 and position 14<>2 F02F0002 Text: 12C1&14NC2
Format 3: if position 12<>1 F0312NC1 Text: 12NC1.
LST_CTYPE
– Type and length of the field A(30), S(6,0), P(11,2)-
LST_CTXT
– Text contains the format conditions first (if there are any) followed by the character |.Then one or several field names found in the RPG… programs.
LST_JXLIB
– RPG name of file (for info): One of the names given to this file in one of the RPG programs.
LSTDBFS36 list
Original File
File Attribute Field format Type Library Text
ARTTARP1 PF36 F01 P0001L0010 A(10) ARTICLES |ARCODE,
ARTTARP1 PF36 F01 P0011L0006 S(6,0) ARTICLES |ARDTAP,
ARTTARP1 PF36 F01 P0017L0030 A(30) ARTICLES |ARDES,
ARTTARP1 PF36 F01 P0047L0005 P(9,0) ARTICLES |ARQTE1,
ARTTARP1 PF36 F01 P0052L0005 P(9,3) ARTICLES |ARPU1,
ARTTARP1 PF36 F01 P0057L0005 P(9,0) ARTICLES |ARQTE2,
ARTTARP1 PF36 F01 P0062L0005 P(9,3) ARTICLES |ARPU2,
ARTTARP1 PF36 F01 P0067L0005 P(9,0) ARTICLES |ARQTE3,
ARTTARP1 PF36 F01 P0072L0005 P(9,3) ARTICLES |ARPU3,
ARTTARP1 PF36 F01 P0077L0005 P(9,3) ARTICLES |ARPU9,
ARTTARP1 PF36 F01 P0082L0002 S(2,0) ARTICLES |ARJJCR,
ARTTARP1 PF36 F01 P0084L0002 S(2,0) ARTICLES |ARMMCR,
ARTTARP1 PF36 F01 P0086L0002 S(2,0) ARTICLES |ARAACR,
ARTTARP1 PF36 F01 P0088L0006 S(6,0) ARTICLES |ARDAMD,
ARTTARP1 PF36 F01 P0093L0001 A(1) ARTICLES |******,
CLIENTP1 PF36 F02 P0001L0008 A(8) CLIENTS |CLCODE,
CLIENTP1 PF36 F02 P0009L0006 S(6,0) CLIENTS |CLDACR,
CLIENTP1 PF36 F02 P0015L0006 S(6,0) CLIENTS |CLDAMD,
CLIENTP1 PF36 F02 P0021L0008 P(15,2) CLIENTS |CLMCAF,
CLIENTP1 PF36 F02 P0029L0006 P(11,0) CLIENTS |CLMASS,
CLIENTP1 PF36 F02 P0035L0030 A(30) CLIENTS |CLLIBE,
CLIENTP1 PF36 F02 P0065L0030 A(30) CLIENTS |CLADR1,
CLIENTP1 PF36 F02 P0095L0030 A(30) CLIENTS |CLADR2,
CLIENTP1 PF36 F02 P0125L0005 A(5) CLIENTS |CLCDP,
CLIENTP1 PF36 F02 P0130L0030 A(30) CLIENTS |CLVILL,
CLIENTP1 PF36 F02 P0159L0001 A(1) CLIENTS |******,
The ****** describe a fictive field positioned on the last character of the record which proves useful when generating recovery programs.
Constitution of the list of fields to process
The process to run is the same as for a list of actual database fields, except for:
- the entry list is the list of non-D.B. fields – LSTDBFS36.
- the extraction macro cannot take the field name (
LST_JOBJ
) into account; it can, however, use RPG names of fields (present inLST_CTXT
).
If an application is mixed, it is possible to merge this list of PF36 fields with the list of database fields for physical files to run only one propagation process.
Propagation and modifications
For more information about propagation, refer to Internal descriptions.
The multi-format files are managed (if those conditions that allow format recognition are present in the programs).
It is necessary that the descriptive file for all DB fields LSTDBFS36 is present online (check this beforehand with WRKOBJ
).
To run ACVTPGMFLD
, it must be named as such.
Particularity for non-database files (identified by PF36)
Generation of Recovery Programs
Principle: The AGENFMTPGM
command will generate an RPGLE program for each modified file.
Input: The file with its old description (under the name FIINPUT with the processed fields and the rest of the records in the other fields).
Output: A non-indexed FIOUTPUT file with the new description.
Each processed field will be formatted in relation to the standard routine (to go to the field in output).
In addition, a CRTPF
process is inserted to the RPGLE program to create the file in output with its new length.
It is necessary that the descriptive file for all the D.B. LSTDBFS36 fields be online (check this beforehand with WRKOBJ
).
To run AGENFMTPGM
it must be named as such.
Generation of an associated file
An associated file can also be managed for these files without DDS.
It will have the same name as the processed file; however, DDS will be generated for this file:
A R FMT
A* Primary Keys
A* Fields
A BFL001 5P 4 TEXT('8NC0&21CA|PUART, ')
A* Keys
A K KEY001
A KEY001 7A TEXT('8C0|NOCDE, ')
For a field to appear as a primary key in this file, you must modify the LSTDBFS36 list and enter indicate KEY in the column LST_JZSEL1
selection field of the file.
Also, in the case of a multi-format file, the fields to process detected in the different formats are reused in the description of this associated file in the same record. On each creation of a record for this file, only the keys and fields to process from the current record format are populated.
Execution of recovery programs
Run the AEXCFMTPGM
command on IBM i. These programs create a sequential file, for each file, containing the data and the correctly-formatted data (according to the new file division).
These new files are placed in a new library, (for which you must specify the name when running AEXCFMTPGM
). Then, you must carry out the following operations:
- Delete the old PF36 file and its INDEX.
- Recreate the new file with
BLDFILE
orCRTPF
. - Copy the data from the formatted file to the new file with using CPYF LVLCHK(*NO).
- Recreate the index using
BLDINDEX
orCRTLF
. (The BLDFILE and BLDINDEX may have been automatically converted, if they were present in an OCL36.)