Variable length v fixed fields - DD control?

HolderAndrew

Well Known Member
Hi List

I have an interesting problem i think, we are trying to understand when generating a table on the iseries from within OMW, how a column is created as "variable length" or not. We are on E1 9.1.5.5 but the same also occurs on earlier releases.

For example in table F03B920C the CRTC alias is defined as a string of length 300 in the DD (ie. it has a data class value of '2' for STRING and not VARLEN) but when the table is generated on the iseries the field is defined as below (ie variable length, with buffer length of 602)


Data Field Buffer Buffer Field Column
Field Type Length Length Position Usage Heading
ZDCRTC GRAPHIC 300 602 1 Both ZDCRTC
Variable length field -- Allocated length : None
Allows the null value
Coded Character Set Identifier . . . . . : 13488
UCS2 or Unicode conversion . . . . . . . : *CONVERT

How does the "engine" create this field as veriable length? How is this controlled?

Best regards,
Andrew
 
Hey Andrew,

I can't speak to the text you see above that states "Variable length field". I do not know why the iSeries shows that text.

If you're confused about the 300 length and 602 buffer length... that is just stating that the string can contain 300 characters. Strings are always stored with an extra character to allow for the null terminating character. So a 300-length string has storage for 301 characters. Since you're on a Unicode release, the actual number of bytes required in the record buffer is 2x301 = 602.

If you already knew that info and you are wondering why you see the "Variable length field" text, I would look at how other fields appear in that output screen... try a few samples of differing lengths (<300, <200, <100, etc.) to see if that text changes based on field length.
 
Hi,
Thanks for the reply.

I know why this is being done, basically to save storage. The first 2 bytes in a variable length field are used to store the actual character string length and so only the necessary sizes are physically stored in the db. I know also that when you generate tables with character string length 100 and 200 that they remain as "fixed" (ie. not variable length) definitions . My question is how this can be controlled as we want non-variable strings. In the DD you assign a data type (UDC H98/DT) and these are assigned as type '2' for 'string'. I would expect that only DD items with type '20' for 'variable string' would actually be created as variable length.

The reason this is important is that we have some comms jobs that have been working happily for 18 years and now are failing because the data is now corrupt. The workaround is to define the tables used in these comms jobs on iseries side in DDS with simple character definition.

I assume that deep down somwhere in the engine (ie. in apis that submit the CRTPF command) that the toolset is assigning VARLEN for DD items above a certain threshold size. I notice that the F000165 TXKY column (size 254) is also variable length - so the threshold value is between 200 and 300. The big question is how this can be controlled in E1.

I have raised SR with Oracle but they reply that our issue is related to custom code.

Brgds
Andrew
 
Hi,

for those that are interested here are the details - the DB2 default is to force variable length of fields > 254 long


E1 OMW Generated (Creates VARGRAPHIC for any field > 255 characters)

CREATE TABLE DVFIDTA/F57060 (SJ$GS5 GRAPHIC (50) CCSID 13488, SJ$TXT VARGRAPHIC (500) CCSID 13488,
SJUSER GRAPHIC (10) CCSID 13488, SJPID GRAPHIC (10) CCSID 13488, SJJOBN GRAPHIC (10) CCSID 13488,
SJUPMJ NUMERIC(6), SJUPMT NUMERIC(6,0))

Format Fields Length Identifier
F57060 7 1174 4556C6502617F
Text . . . . . . . . . . . . . . . . . . . :
Total number of formats . . . . . . . . . . : 1
Total number of fields . . . . . . . . . . . : 7
Total record length . . . . . . . . . . . . : 1174
Manually Created (Force GRAPHIC only)


CREATE TABLE DVFIDTA/F57060 (SJ$GS5 GRAPHIC (50) CCSID 13488, SJ$TXT GRAPHIC (500) CCSID 13488,
SJUSER GRAPHIC (10) CCSID 13488, SJPID GRAPHIC (10) CCSID 13488, SJJOBN GRAPHIC (10) CCSID 13488,
SJUPMJ NUMERIC(6), SJUPMT NUMERIC(6,0))

Record Format Level
Format Fields Length Identifier
F57060 7 1172 3CF65DEFE4D6B
Text . . . . . . . . . . . . . . . . . . . :
Total number of formats . . . . . . . . . . : 1
Total number of fields . . . . . . . . . . . : 7
Total record length . . . . . . . . . . . . : 1172


Brgds
Andrew
 
Back
Top