i5_info Calculate correct field length

i5_info Calculate correct field length

Postby kfm-hotline on Fri Mar 16, 2012 11:30 am

Hello,

i have a problem with calculate the corret field length for some DB-fields on a i5.

i have a DB-Table with some fields:
FIRNR 00004P00
BERNR 00007P00
KTOKZ 00001A
GN0GR 00001P00
K FIRNR SIGNED
K BERNR SIGNED

when i call i5_info on every field: (comment and headings not shown in this post)

name => FIRNR
PcType => 1
PcLen => 2
AsType => 6 == PACKED
AsLen => 3
AsDec => 0
allowNull => 0
varLen => 0
i5_fieldlength : 2

name => BERNR
PcType => 2
PcLen => 4
AsType => 6 == PACKED
AsLen => 4
AsDec => 0
allowNull => 0
varLen => 0
i5_fieldlength: 4

name => KTOKZ
PcType => 0
PcLen => 1
AsType => 0 == CHAR
AsLen => 1
AsDec => 0
allowNull => 0
varLen => 0
i5_fieldlength: 1

name => GN0GR
PcType => 1
PcLen => 2
AsType => 6 == PACKED
AsLen => 1
AsDec => 0
allowNull => 0
varLen => 0
i5_fieldlength: 2

first Question: for what stand PcType? and what are the differnces between PcType 0, 1 and 2 ?

second : How can i calculate the correct length for PACKED fields?

i found this site:
http://publib.boulder.ibm.com/iseries/v ... HDRPADECFO
that says: 2 * n - 1 ; n = AsLen
so:
FIRNR: 2*3 -1 = 5 <= this should 4?
BERNR: 2*4 - 1 = 7
GN0GR: 2 * 1 - 1 = 1

Regards
Manuel
kfm-hotline
 
Posts: 9
Joined: Thu Dec 08, 2011 1:44 pm

Re: i5_info Calculate correct field length

Postby aseiden on Fri Mar 16, 2012 7:24 pm

Hi, Manuel,

First: are you using the Easycom toolkit or the new CW? The CW doesn't include i5_info and a few other database/field operations. db2_ functions still work, though, so most people are using those.

What do you need to do? Are you creating a data structure? The new toolkit supports detecting data structure and field lengths when calling a program and passing parameters. I can tell you how to do this, if you wish.

Alan
aseiden
 
Posts: 697
Joined: Thu Apr 09, 2009 5:45 pm

Re: i5_info Calculate correct field length

Postby kfm-hotline on Mon Mar 19, 2012 10:36 am

Hey,

i am using the Easycom toolkit (but not the class that was included) (i5_pconnect, i5_open, i5_seek and so on )

I want to build a variable layout for input - fields with the correct length of the DB-Fields, so the user cant enter more char as possible.


How i call a RPG-Program, i know!

Regards,
Manuel
kfm-hotline
 
Posts: 9
Joined: Thu Dec 08, 2011 1:44 pm


Return to Zend Server for IBM i

Who is online

Users browsing this forum: No registered users and 1 guest