Assembler Copy Code

The function Generate Assembler Copy Code generates a record buffer for use in Assembler programs based on a Predict file object.

In addition, an Adabas format buffer can also be generated if required for files of the following types:

  • Adabas file (file type A) with parameter Adabas SQL usage = N

  • Adabas userview (file type U)

This document covers the following topics:

Calling the Function

The Generate Assembler Copy Code screen is displayed with function code G and object code BA in a Predict main menu or with the command GENERATE BAL or GENERATE ASSEMBLER.

09:43:39             *****  P R E D I C T  *****             2007-05-31
Plan   0              - Generate ASSEMBLER Copy Code -

File ID ...................*

Save as member .............                Save in library .... BALLIB
Overwrite option ........... Y  (Y,N)       Op. system member ..
Punch / output ............* N

List generated code ........ Y  (Y,N)       List offsets ......* N
Generate format buffer ....* N              Adabas version ....* I7

As DSECT ................... N  (Y,N)       Field name prefix ..
With DC or DS .............* DC             Field name suffix ..
Nr. of abstract lines ...... 4  (0-16)      Validate ........... *
Generate initial value ..... N  (Y,N)       Truncation ........* R
Align .....................* N              With EQUs .......... Y (Y,N)
DSECT name .................                Counter length ..... 1 (1,2)
Format buffer name .........

Command ===>
      Help  Next  Stop  Last  LnkEl Flip  Print Impl  AdmFi SelFi Prof  Main


Values for fields which have been locked by your data dictionary administrator cannot be overwritten. These fields are skipped when positioning the cursor with the TAB key. See Generation Defaults.

The parameter below can be changed in the Modify BAL Defaults screen. See Generation Defaults.
Library system Library system for which the generated code is punched. Determines which additional cards need to be punched. An operating system member must be entered for the additional cards to be generated. See Parameters Specifying the Form of Output for more information.
The parameters Save as member, Save in library, Overwrite option, Op. system member, Punch/output, Workfile name and List generated code are described in the section Parameters Specifying the Form of Output.
File ID ID of the Predict file object from which the definitions are to be generated. Enter an asterisk to display a selection screen. Alternatively, use an asterisk as a wildcard. For example, enter A* to display IDs beginning with A only.
List offsets
Y Include the offset of each item in the record buffer structure (relative to the beginning of the structure) in decimal and hexadecimal formats as a comment. The total length of each buffer is also included.
P Include the absolute position (offset+1) as a comment.
L Include the total lengths of the record buffer and the format buffer as a comment.
V Only allowed if parameters As DSECT=N and With DC or DS=DC. The file number and the calculated lengths of the record buffer and the format buffer are to be generated as constants in the copy code. The name of the file number constant is the record buffer name with N as prefix. The name of each length constant is the appropriate buffer name with L as prefix. Each name is prefixed, suffixed, validated and truncated in the same way as any other field name.
N No offset.
Generate format buffer
Format buffer generation for Assembler copy code is only allowed if parameters As DSECT=N and With DC or DS=DC. The contents of the format buffer will correspond exactly to the contents of the record buffer. Only valid for files of type A (with parameter Adabas SQL usage set to N) or for files of type U.
Valid values:
Y Adabas format buffer is to be generated. Adabas groups, standard formats and lengths are used whenever possible. The resulting format buffers are then as short as possible.
F Full format buffer is to be generated. Length and format of Adabas fields are included.
N No format buffer is to be generated.

If you are generating for a WANG environment, set this parameter to F or N.

Adabas version The version of Adabas for which the copy code is to be generated. Enter an asterisk for valid values or see table in the section Adabas Version.
As DSECT The effect of this parameter depends on the parameter DSECT name. See table below:
As DSECT DSECT name Copy Code Generated
Y specified <DSECT name> DSECT
Y blank <File-ID> DSECT
N specified <DSECT name> DS OCLnnn

nnn=Length of the record buffer structure

N blank Only entries for fields are generated
N *(asterisk) <File-ID> DS OCLnnn

nnn=Length of the record buffer structure

Field name prefix The prefix to be used for each field name generated.
With DC or DS
DC Assembler DC (define constant) instruction is to be used. If AS DSECT=Y, this parameter must be set to DS.
DS Assembler DS (define storage) instruction is to be used.
Field name suffix The suffix to be used for each field name generated.
Nr. of abstract lines The number of Predict abstract lines per field to be included in the generated code.
Determines how invalid characters are handled.
blank Invalid characters in a field name will result in an error message but will not be modified.
rep.char Invalid characters in a field name are replaced by this character. Valid replace characters: letters A-Z, digits 0-9, $, § and #.
* Invalid characters in a field name are deleted.
Generate initial value
This option takes effect only when With DC or DS=DC and As DSECT is set to N.
N No initialization.

Statements are generated to initialize the structure with the value specified for Init value in the corresponding field object in Predict. Fields with no value for Init value are initialized with zeros or blanks.

Aligned 8-digit fields with format B or I are not initialized.

In a PE group with the 3GL specification Gr.structur set to blank, only the first occurrence of each field is initialized.

Specifies which characters are deleted if a generated field name is too long:
L truncate from the left
R truncate from the right
M truncate from the middle
A warning is given if field names are truncated.
Determines which fields are to be aligned. Fields are aligned on the boundary shown in the table in the section Field Format and Assembler Copy Code.
Y All appropriate fields are aligned.
N No fields are aligned.
S Fields are aligned only if the corresponding Predict field object has the 3GL specification Synchronized=S.
With EQUs

EQU statements are to be generated for fields of length 1 whose format is not P and comment lines are to be generated for other fields, using any condition names defined as attributes of the Predict field objects. These names are prefixed, suffixed, validated and truncated in the same way as field names.

For fields of format L where no condition name was specified, a condition name is generated by concatenating the field name "Example" to the prefix N. In this case the following statement is generated: NEXAMPLE EQU X'00'.

DSECT name Specifies the name of the record buffer in the generated structure. The effect of this parameter depends on parameter AS DSECT. See above in this table.
Counter length Length of additional counter fields. Valid values: 1, 2
Format buffer name Specifies the name of the format buffer in the generated structure. If omitted, the file ID prefixed by F is used.

Generate Assembler Copy Code in Batch Mode


Enter parameters on next line in positional or keyword form. File ID is obligatory, all other parameters are optional.

Field Keyword Position
Save as member MEM 2
Save in library LIB 3
Overwrite option REPLACE 4
Op. system member OS-MEMBER 5
Field name prefix PREFIX 7
With DC or DS DC-DS 8
Field name suffix SUFFIX 9
Nr. of abstract lines NR 10
Generate initial value INIT 11
Validate VALIDATION 12
Generate format buffer FORMAT-BUFFER 13
Truncation TRUNCATION 14
List offsets OFFSET 15
List generated code LIST 16
Punch / output PUNCH 17
Format buffer name FORMAT-BUFFER-NAME 19
Align SYNC 20
With EQUs EQU 21
Adabas version ADA-VER 22
Counter length COUNTER-LENGTH 23
Workfile name (see note below)   24
If you are working with Entire System Server  
- Data set NP-DSNAME 26
- Volume NP-VOLSER 27
- Library NP-LIB 28
- Sublibrary NP-SUBLIB 29
- Member type NP-MEMTYPE 30
- VSAM catalog NP-VSAMCAT 31

If a parameter is not specified, the default value is taken.

You cannot specify a value other than blank (' ') for WORKFILE-NAME on mainframes.

Parameters NP-LIB, NP-SUBLIB and NP-MEMTYPE must be specified if the generated code is written to workfile 1 (Punch/output=Y) and Library system=3.

Names in Assembler Copy Code

The following rules apply to the generation of names for Assembler copy code.

  • Alpha characters in Predict object IDs, such as file and field IDs, are converted to upper-case.

  • Each field name (label) used in Assembler copy code is taken from the corresponding Predict field object: either the field name synonym for Assembler or, if none exists, the Predict field ID.

  • All field names and any condition names are prefixed, suffixed, validated and - if necessary - truncated to 8 characters according to the parameter settings. For example, with Field name prefix set to JUN, Field name suffix to *86, Validate to § and Truncation to R two fields JUNCDAY§ and JUNDAY§8 are generated for a field of type MC called DAY.

  • If a resulting field name is not unique within the entire file structure, an error message is given.

  • Any DSECT name or format buffer name does not receive the field name prefix and suffix. The value supplied may not contain invalid characters.

  • If the file ID is taken as default DSECT name or, with the prefix F, as default format buffer name, it is validated and if necessary truncated.

Assembler Names for Counter Fields - MC or PC

Before each field of type MC or PC, a counter field is generated automatically in the copy code, with a name created from the name of the MC or PC field prefixed by C. For example, a Predict field object DAY with no field name synonym for Assembler and with type MC will generate two fields with the names CDAY and DAY.

Assembler Names for Logical Fields - L

If no condition name is defined for a logical field (format L), the field name prefixed by N is used for the EQU statement.

Assembler Names for Fields of Type AV

For fields of format AV, a group is generated where groupname=fieldname. The group contains a length field and a text field prefixed with L and T respectively. See second table in the section Field Format and Assembler Copy Code.

Assembler Names for Additionally Generated Indicator Fields

An additional indicator field prefixed with S is generated in the following cases:

  • a field is defined with Suppression option set to U (null allowed)

  • a field of a file of type A, U or B is defined with Suppression option set to R (not null)

For Adabas Fields, the additional indicator field is only generated for the following Adabas versions:

  • I3 or above

  • U1 or above

  • V4 or above.

Field Format and Assembler Copy Code

Fields in the Assembler copy code have a clause determined by the following factors:

  • length and format of the corresponding Predict field object

  • file type of the file containing the field

Predict Format File Type PRD Length Alignment Boundary Assembler Clause (if aligned) Note
B   1   XL1    
l =3,5,6,7   XLl      
I   1   XL1    
B/I   2 2 XL2 H  
4 4 XL4 FL4  
8 4 XL8 FL8  
B   l=>9   PIC X(l)    
F   4 4 CL4 E  
8 8 CL8 D  

NS/US (nn+m<17)

  nn.m   ZLl     l=nn+m

NS/US (nn+m>16)

  nn.m   CLl     l=nn+m
P/PS   nn.m   PLl     l=(nn+m+2) /2
D D, E     CL10    
other     PL4    
T D, E     CL8    
other     PL7    
L       XL1    
G   n   CLm    m=2*n 
GL   n   CLm    m=2*n 
GV   n   CLm    m=2*n 
LO D, E   4 XL4 FL4  

The clause XLn is normally generated for B formats. There are two exceptions to this rule:

  • parameter Align is set to Y, or

  • parameter Align is set to S and the field is defined in Predict as Synchronized.

The clause H or FL4 or FL8 is normally generated for I formats. The exception to this rule is when the parameter Align is set to N and the field does not start at a "synchronized" address.

An indicator or length field is generated like a B2 field. A counter field is also generated like a B2 field if Counter length = 2. If Counter length = 1, the clause XL1 is generated.

A numerical format field with a length > 17 is treated in Assembler copy code as alphanumeric format field. No INIT VALUE can be generated for these fields and a warning is given.

A DB2 large object is generated as locator like an I4 field.

When generating Assembler copy code for DB2 tables and views, format NS or US is converted to Assembler format PL. Any redefinitions that exist for this field are skipped.

File Type in Predict Predict Format Length Assembler Clause Note
D, E A, AL n CLn   
AV Two-level group is generated:

Fieldname DS CLm
FieldnameL Dx yyy
FieldnameT Dx CLn

m = n + 2

Dx is either DS or DC, depending on parameter With DC or DS.

yyy is either XL2 or H, like a B2 field.

A,U,B A CLn   
AV Two-level group is generated. See above.  

Sample Output


*               ON: 2007-05-31 STARTING AT 13:27:40
*    FILE COMMENTS: Example file for the 
*                   PREDICT generation subsystem
*                   ..
         DS    0D
GROUP1   DS    0CL99
ELN9V5   DC    ZL14'0'        ELE-N-9V5
GRINGR   DS    0CL30
ELEB4    DC    FL4'0'         ELE-B-4
*                     CONDITION NAMES:
*                     INIT-ELE-B-4=00001000
*                     COND-ELE-B-4-V-1=FFFFFFFF
ELPS52   DC    PL4'0'         ELE-PS-5V2
MUB4     DC    5FL4'0'        MU-B-4
         ORG   MUB4
MURB7    DC    XL7'0'         MU-RED-B-7
MURB13   DC    ZL13'0'        MU-RED-US-13
         ORG   MUB4
MURB8    DC    XL8'0'         MU-RED-B-8
*                     CONDITION NAMES:
*                     MU-RED-B-8-COND1=111111
         DS    CL12
ELEA42   DC    CL42' '        ELE-A-42
*                     CONDITION NAMES:
*                     COND-NAME-START=COND-START
*                     *THRU=COND-ZEND

ELEF8    DC    D'0'           ELE-F-8
ELEB3    DC    XL3'0'         ELE-B-3
CPCOCC7  DC    XL1'0'         CNT OF PC-OCC-7
PCOCC7   DS    0CL76
PCNS7V3  DC    ZL10'0'        PC-ELE-DE-NS-7V3
CPCMCPS  DC    XL1'0'         CNT OF PC-MC-PS-6V1
PCMCPS   DC    11PL4'0'       PC-MC-PS-6V1
PCGR     DS    0CL17
BALI2    DC    H'0'           PC-ELE-I-2
PCPS20V7 DC    PL14'0'        PC-PS-20V7
BALF4    DC    E'0'           PC-ELE-F-4
         DS    6CL76
ELED     DC    PL4'0'         ELE-D
ELET     DC    PL7'0'         ELE-T
ELEL     DC    XL1'0'         ELE-L
NELEL    EQU   X'00'
*               ON: 2007-05-31 STARTING AT 13:27:40
         DC    CL50'AB,2X,AD,AE,AF1-5,AG,2X,AH,AI,ALC,AM1,AN1C,2,AN1(1'
         DC    CL50'-11),1X,AP1,AQ1,AR1,AM2,AN2C,2,AN2(1-11),1X,AP2,AQ'
         DC    CL50'2,AR2,AM3,AN3C,2,AN3(1-11),1X,AP3,AQ3,AR3,AM4,AN4C'
         DC    CL50',2,AN4(1-11),1X,AP4,AQ4,AR4,AM5,AN5C,2,AN5(1-11),1'
         DC    CL50'X,AP5,AQ5,AR5,AM6,AN6C,2,AN6(1-11),1X,AP6,AQ6,AR6,'
         DC    CL45'AM7,AN7C,2,AN7(1-11),1X,AP7,AQ7,AR7,AS,AT,AU.'