Re: Db2dclgn Indicator variables
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx>
- Date: Mon, 22 Jan 2007 04:17:30 GMT
Yes and no.
It is true that "49-levels" are used by most (all?) SQL products for holding
the length for VARCHAR fields. However, they are NOT "special level" numbers
like 77 or 66 that have any specific meanings to COBOL.
You can code:
49 This Pic X.
49 That Pic 9.
49 Whatever occurs 10 times
wmklein <at> ix.netcom.com
"Michael Russell" <Michael.Russell@xxxxxxx> wrote in message
Aren't level-49s there for lengths of varchars?
Frank Swarbrick wrote:
For instance, I'd love to see a COBOL that supports the ANY LENGTH PREFIXED
clause for a much more natural VARCHAR. Just think of it:
05 EMPNO PIC X(6).
05 FIRSTNME PIC X ANY LENGTH
LIMIT IS 12 PREFIXED BY BINARY-SHORT.
05 MIDINIT PIC X(1).
05 LASTNAME PIC X ANY LENGTH
LIMIT IS 15
PREFIXED BY BINARY-SHORT.
05 WORKDEPT PIC X(3).
FETCH EMPNO, FIRSTNME, MIDINIT, LASTNAME, WORKDEPT
INTO :EMPNO, :FIRSTNME, :MIDINIT, :LASTNAME, :WORKDEPT
MOVE 'NEWNAME' INTO LASTNAME
SET LASTNAME = :LASTNAME
WHERE CURRENT OF CURSOR
No fiddling around with INSPECT ... in order to get the length of the field
(sans trailing spaces), no need for the SQL RTRIM function, or any other
Of course this almost seems a pipe dream. Even if, say, Micro Focus
implemented this feature, we'd still have to have IBM implement support for
it into the precompiler. (Or does MF use it's own pre-compiler?)
I'd also love to see some kind of COBOL support for "null" values. Even
with the proposed COBOL 2008 features (of which ANY LENGTH PREFIXED is one)
I don't think there's anyway way to specify a field (other than an actual
pointer, of course), as having a value of "NULL". But I'd love to see it! I
know that C# has support for this. Never seen any other language with it,
Back to the real world, though...
As someone else said, you can just use DAT OF LASTNAME (or DAT IN LASTNAME)
to uniquely qualify that field. (Again, I personally would love to use
Also, there is of course nothing that says you can't edit the output from
db2dclgn prior to using it. I personally would do that unless perhaps I had
several hundred columns and no time to fiddle around editing them. You only
have to do it once. As you add new fields you just put them into the
copybook by hand, maybe using db2dclgn to guide you to the proper PICTURE
Hope this helps, and is accurate. As I said, I could be wrong about the IND
thing, but I believe I am correct.
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
- Prev by Date: Re: Db2dclgn Indicator variables
- Next by Date: txm decode
- Previous by thread: Re: Db2dclgn Indicator variables
- Next by thread: Re: Db2dclgn Indicator variables