Re: Db2dclgn Indicator variables
- From: Michael Russell <Michael.Russell@xxxxxxx>
- Date: Sun, 21 Jan 2007 09:39:00 +0000
top post.
Aren't level-49s there for lengths of varchars?
Regards
Michael
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:
01 EMPLOYEE.
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).
EXEC SQL
FETCH EMPNO, FIRSTNME, MIDINIT, LASTNAME, WORKDEPT
FROM EMPLOYEE
INTO :EMPNO, :FIRSTNME, :MIDINIT, :LASTNAME, :WORKDEPT
END-EXEC
MOVE 'NEWNAME' INTO LASTNAME
EXEC SQL
UPDATE EMPLOYEE
SET LASTNAME = :LASTNAME
WHERE CURRENT OF CURSOR
END-EXEC
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
annoying workarounds.
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,
though.
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
LASTNAME.DAT).
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
and USAGE.
Hope this helps, and is accurate. As I said, I could be wrong about the IND
thing, but I believe I am correct.
Frank
--- Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
- Follow-Ups:
- Re: Db2dclgn Indicator variables
- From: Frank Swarbrick
- Re: Db2dclgn Indicator variables
- From: William M. Klein
- Re: Db2dclgn Indicator variables
- References:
- Db2dclgn Indicator variables
- From: Dan van Ginhoven
- Re: Db2dclgn Indicator variables
- From: Frank Swarbrick
- Db2dclgn Indicator variables
- Prev by Date: Looking for A Screen Scraper
- Next by Date: Re: Db2dclgn Indicator variables
- Previous by thread: Re: Db2dclgn Indicator variables
- Next by thread: Re: Db2dclgn Indicator variables
- Index(es):
Relevant Pages
|