Field lists
Lists of fields to transform serve as a base for field conversion. To convert fields you must:
- (Re-)generate the list of all database fields.
- Build the list of fields to be processed.
- Define a field format for each of these fields.
Even when the database repository is correctly loaded (visible through ADSPFLDDCT
), it is necessary to generate it in the form of a list. Use option Create/Refresh list of database fields of the TRANSFORM menu which runs the FLDDCT
macro. The macro will:
- initialize the application environment (put the correct libraries online).
- create an empty LSTDBFFLD list in the library which should contain the application lists.
- build the list of the application database files (*FILE, type PF or PF38 or TABLE) (in the LSTPF list).
- use this list (for each physical file) to build the LSTDBFFLD list which will then contain all the fields for all the physical files of the application.
The resulting list is not maintained; it is necessary to restart the FLDDCT once files are added (or modified) in the repository.
You can then visualize this list with the following option Display the database fields list.
All the processes in ARCAD Transformer Field require a list of fields to process (fields to be propagated) as a starting point.
For more information about the contents of this list, see The propagation layout.
You can build this list (for file fields) several different ways. Whichever method is used, you will have the same results each time.
This EXT… macro-command always has the same role: it starts with the list of database fields (LSTDBFFLD) to obtain the list of fields to propagate (LSTxxxx), by successive extractions.
Parameter | Description |
---|---|
Application ID | (as it is an *APP type macro) |
Entry list | (&PFL) normally contains the LSTDBFFLD |
Destination list | (&PTL) enter the name of the result list |
The resulting list is created by default in the (&ALSTLIB) library; this is the library where your application lists are stored.
The macro must:
- create the result list LSTxxxx.
- create, when necessary, the intermediate lists in QTEMP.
- extract the fields in the LSTDBFFLD list (or in the intermediate list) using
AEXTLST
and place them in the LSTxxxx list (or an intermediate list). - repeat as much extraction as necessary.
- delete the Field/FMT/File duplicates from the resulting list (using an
AUPDLST
). - and if necessary, display or print the resulting list.
The easiest way to create your macro-command is to copy one of the standard macro-commands (with AWRKMACCMD
EXTFLD
and 3 Copy to XXX/EXT…), then to modify it using AWRKMACCMD
XXX/EXT…
Preferably, create your macro-command in a personal library or in a library of your application.
For more information about macro-commands and extraction command, refer to the Help in the ARCAD Process Manager and ARCAD List Manager menus.
Base the extraction on one or more of the following criteria:
Criteria | Description |
---|---|
Library/File format (LST_JLIB ) |
Contains the name of the file format. |
Object/member/field (LSOBJ ) |
Contains the field name. |
Type (object/source/field) (LST_CTYPE ) |
Contains the type and length of the field. A(lg) if the field is alphanumeric, S(lg,nb dec) or P(lg,nb dec) if the field is an extended or packed numeric field. |
Object/type component attribute (LST_CATR ) |
Contains the type of PF: PF or PF38 |
Text (contains type) (LST_CTXT ) |
The field’s text. |
Source file/field file (LST_JSRCF ) |
Name of physical file. |
To run the macro, start the command (either directly or via a SBMJOB
) then press F4 to define the parameters.
Use the AEDTLST
command and define the name of the result list (with its library, if necessary) and press F4. The options list LST_CSTST > FIELDS.
This allows you to obtain the options adapted to a list of file fields in the screen that follows.
The field list displayed may not be the one you expected. It may contain excess fields (not concerned by your problem) or it may not be able to contain fields (even if you think they are useful) if they do not meet the selected criteria.
In this case, try to improve your macro (with other extraction criteria). Continue repeating this process until you get satisfying results.
Be careful. Restarting the extraction macro will completely re-execute every action. Therefore, you must wait until it is finished before removing (or suspending) any fields.
If only a few fields are missing, because they do not meet the selected criteria, you can easily retrieve them from the list of database fields and copy them manually to the list of fields to propagate. AEDTLST LSTDBFFLD
displays all the database fields. Enter 3 next to the field(s) chosen and enter TOLIST(lib/LSTxxxx) at the end of the screen.
In case of any doubts, and to avoid adding the same field several times, finish by entering AUPDLST lib/LSTxxxx
which will remove any eventual duplicates.
If ARCAD Observer is accessible on a PC connected to your system, you can navigate in the field repository (database dictionary) and build the list of fields to process by using filters.
Then in ARCAD Observer, request an output of your selection in the form of an ARCAD list.
For more information about this subject, refer to the ARCAD Observer documentation.
You may also already have the list of fields to process on your IBM i or in a PC file.
In this case, using SQL or a program you wrote, you can populate the list directly.
You must always have created the destination list beforehand, using the ACRTLST
command.
You must be able to completely fill in the necessary fields of the list file (ARCAD lists are all in a LSTF file format).
Write a CLP that reads your file and adds the fields to the list of fields to process by copying from the LSTDBFFLD:
- DUPLSTE LST_JOBJ(File/Field name Format)
- LST_CTYPE(field type A(5), etc..)
- FROMLIST(LSTDBFFLD)
- TOLIST(Lib/LSTxxxx)
- CTLELEM(*NO)
- LST_JSRCF(File Name)
You can also write a program that will create entries in the LSTF list file (with an OVRDBF before execution to the destination list).
For a list of fields of a file to propagate, the fields of the LSTF file are to be filled in as given in the following table:
Field Name | Type | Length | Title | Contents for list of fields |
---|---|---|---|---|
LST_CTYPE
|
A | 1 | TYPE OF ITEM (M/O/F) | F for list of Fields |
LST_JOBJ
|
A | 10 | OBJECT/MEMBER/FIELD | Field Name |
LST_JLIB
|
A | 10 | LIBRARY/FIELD FORMAT | File Format Name |
LST_CCPLT
|
A | 7 | COMPILE TYPE OR PROPAG FMT | Field Format |
LST_CTYPE
|
A | 10 | OBJECT/MEMBER/FIELD TYPE | Field Type: A(5) P(6,2) |
LST_CATR
|
A | 10 | OBJECT ATTRIBUTE | PF or PF38 File Type |
LST_JSRCF
|
A | 10 | SOURCE FILE/FIELD FILE | Physical file name |
LST_JXLIB
|
A | 10 | CREATION LIBRARY | Name of file’s library |
LST_TDATE
|
A | 10 | DATE | Blank |
LST_NORD
|
P | 2 | ORDER N° | 0 (zero) |
LST_CSTS
|
A | 1 | STATUS | Blank |
LST_CTXT
|
A | 50 | TEXT | Text if available |
LST_TTIME
|
A | 6 | TIME (HHMMSS FMT) | Blank |
LST_JZSEL1
|
A | 10 | SELECTION FIELD | Blankw |
LST_JZSEL2
|
A | 30 | SELECTION FIELD 2 | Blank (or name of new fld 3) |
LST_CSST
|
A | 12 | TREE | Blank (or name of new fld) |
This operation is absolutely necessary as it is by this bias that the link between the fields and the types of propagation is carried out. The goal is to allocate a field format for each field.
Normally, the field format should be placed in the list in the LST_CCPLT
(field format) field.
However, even though the width of this field is limited to 7 characters, it is possible in particular cases to indicate a compressed field format of 50 characters by using the text field (LST_CTXT
). Iis case:
- enter TEXT in the field format (
LST_CCPLT
), - enter the compressed field format in
LST_CTXT
(Text)
(This is the most complicated case possible) - Format of a file field “FILLER” of 100 characters (type of propagation A):
- Contains a field to propagate on 9 digits in position 21 to 29 (extended),
- and another field to propagate on 15 digits in position 62 to 69 (packed on 8 characters).
Field format (LST_CCPLT)-> TEXT
Text-> 20.A8a32.(6-)31./A14a/
Several methods are possible to set the format for each field:
Use the ASETFLDFMT
command as follows:
Set field format (ASETFLDFMT)
Type choices, press Enter.
Application ID . . . . . . . . *CURENV Character value, *CURENV
List of fields to be modified > LSTSLFLD Name
Library . . . . . . . . . . . > *LIBL Name, *LIBL, *CURLIB, *CURENV
Database file library . . . . > *NONE *LIBL, *FROMLIST, *NONE
Additional Parameters
Default format:
Field length . . . . . . . . . > *OTHER Number, *OTHER
Format . . . . . . . . . . . . > A Character value, *NONE
+ for more values
Restart after abnormal end? . *NO *YES, *NO
Replace XXXXXXX with the letter(s) constituting the field format.
The ASETFLDFMT
command contains other possibilities, notably to determine the field format according to the data contained in the files or to the length of the fields.
Step 1 Use the AEDTLST
command, specifying the name of the result list (with its library when possible) and choosing the options list LST_CSTST > FIELDS
(F4).
Step 2 Select option 2=Change and press F4.
Step 3 Define the field format in Compile type/Field format. You can also enter 2 on several items and on the bottom of the screen, type: LST_CCPLT (field format).
To avoid tedious typing in relation to the number of fields to process using the previous procedure, you can create particular options to do that for you.
Step 1 Use AEDTLST
LST_CSTST (FIELDS) then press F2.
Step 1 Enter 5 next to the Fields option list.
Step 2 Select option 3=Copy, then option 2=Change.
Step 3 Give it a different option name (beginning with a preferred letter). (ex.: R)
Step 4 Press F4 on the ACHGLSTE
command shown further below, and fill in the field format (ex.: ...R).
Step 5 You can now use the new option R directly next to a field in the list in order to allocate the format.