ESTUDAR_MV

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Data type for physical and logical files (position 35)

Last Updated: 2023-04-11

For a physical file, you use this position to specify the data type of the field within the database. You specify data
type in a logical file only to override or change the data type of the corresponding field in the physical file on which
this logical file is based.

If you leave this position blank, the field you are defining has the same data type as the corresponding field in the
physical files on which the logical files are based.

Valid data type entries are as follows:


Entry
Meaning
P
Packed decimal
S
Zoned decimal
B
Binary
F
Floating-point
A
Character
H
Hexadecimal
L
Date
T
Time
Z
Timestamp
5
Binary character
Note: The data types J (only), E (either), O (open), and G (graphic) support DDS database files that use DBCS. The
G (graphic) data type also supports DDS database files that use UCS-2 or UTF-16. The A (character) data type also
supports database files that use UTF-8.
For physical files, if you do not specify a data type or duplicate one from a referenced field, the operating system
assigns the following defaults:
 A (character) if the decimal positions 36 through 37 are blank.
 P (packed decimal) if the decimal positions 36 through 37 contain a number in the range 0 through 63.
Notes:
1. Specify 0 in position 37 to indicate an integer numeric field for packed decimal, zoned decimal, or binary
fields.
2. Specify an F in position 35 for a single precision floating-point field. Use the FLTPCN keyword to specify
double precision or to change the precision of an already specified floating-point field.
3. Specify an H (hexadecimal) in position 35 to indicate a field whose contents are not interpreted by the
system. In most cases, hexadecimal fields are treated as character fields, except that the contents of a
hexadecimal field are not translated to any character set or code page.

The following table shows what types of data conversion are valid between the data types of physical and logical file
fields, where valid conversions are marked with an X or with a reference to the table notes:
// EXEMPLO DDS1 PF
001.00 A UNIQUE
002.00 R RDDS1
003.00 FLD1 10A
004.00 FLD2 20A
005.00 K FLD1

// EXEMPLO DD2 LOGICAL FILE

0001.00 R RDDS2 PFILE(DDS1)


0002.00 FLD1 10A
0003.00 FLD2 20A
0004.00 SORT1 I SST(FLD1 4 1)
0005.00 K SORT1

//EXEMPLO CLP QUE REALIZA A LEITURA DO ARQUIVO DDS1


0001.00 PGM
0002.00 DCL VAR(&VAR1) TYPE(*CHAR) LEN(20)
0003.00 DCL VAR(&REPLY) TYPE(*CHAR) LEN(1) +
0004.00 VALUE('N')
0005.00 DCLF FILE(VEIGAM1/DDS1)
0006.00 READ:
0007.00 RCVF
0008.00 MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END1))
0009.00 CHGVAR VAR(&VAR1) VALUE(&FLD1||' '|| +
0010.00 &FLD2||' '||+
0011.00 ' ')
0012.00 SNDUSRMSG MSG('DO U WANT TO CONTINUE FILE READING') +
0013.00 MSGRPY(&REPLY) VALUES('Y' 'N')
0014.00
0015.00 IF (&REPLY='Y') DO
0016.00 SNDUSRMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&VAR1) +
0017.00 MSGTYPE(*INFO)
0018.00 GOTO CMDLBL(READ)
0019.00 ENDDO
0020.00 ELSE DO
0021.00 GOTO CMDLBL(END2)
0022.00 ENDDO
0023.00 END1:
0024.00 SNDUSRMSG MSG('THE END OF FILE IS REACHED')
0025.00 END2:

You might also like