HP3000-L Archives

December 2003, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Emerson, Tom" <[log in to unmask]>
Reply To:
Emerson, Tom
Date:
Mon, 15 Dec 2003 12:29:48 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (113 lines)
This might provide some insight:

> From: Belkacem Stephen [mailto:[log in to unmask]]

> I'm attempting to create separate order files from one 
> consolidated orders file. To do this, I'm reading the file with the WHILE 
> commands, and then using the SETVAR and ECHO commands to copy the files to a 
> temporary file, which will then be saved in the POSIX directory.

[hold that thought...]
 
> My source file has a file length of 468 characters. At some 
> point within my
> process, there seems to be a limit of 256 characters. Could 
> someone direct
> me to where this is, and how to cure it? Below is the JCL

Just as a quick demo of limits and such, I came up with this:

988/COREDEV/TEMPTE:print looper
setvar x "x"
setvar i 1
while i < 14
echo loop !i; x=!x
echo len(x)=![len(x)]
setvar x x+x
setvar i !i+1
endwhile
988/COREDEV/TEMPTE:looper
loop 1; x=x
len(x)=1
loop 2; x=xx
len(x)=2
loop 3; x=xxxx
len(x)=4
loop 4; x=xxxxxxxx
len(x)=8
loop 5; x=xxxxxxxxxxxxxxxx
len(x)=16
loop 6; x=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
len(x)=32
loop 7; x=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
len(x)=64
loop 8; x=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
len(x)=128
loop 9; x=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
len(x)=256
echo loop 10; x=!x
                ^
Expanded command line exceeds 511 characters. (CIERR 8105)
echo loop 10; x=!x
Error executing commands in WHILE loop. (CIERR 10310)
988/COREDEV/TEMPTE:editor
HP32201A.09.00 EDIT/3000 MON, DEC 15, 2003,  8:59 AM
(C) HEWLETT-PACKARD CO. 1993
/t looper
FILE UNNUMBERED
***WARNING*** RECORD SIZE TRUNCATED TO 255 BYTES.
/d4
    4     echo loop !i; x=!x
/m5
MODIFY     5
echo len(x)=![len(x)]
     iloop !i;
echo loop !i; len(x)=![len(x)]

[saved]
988/COREDEV/TEMPTE:looper
loop 1; len(x)=1
loop 2; len(x)=2
loop 3; len(x)=4
loop 4; len(x)=8
loop 5; len(x)=16
loop 6; len(x)=32
loop 7; len(x)=64
loop 8; len(x)=128
loop 9; len(x)=256
loop 10; len(x)=512
loop 11; len(x)=1024
setvar x x+x
          ^
The length of the string is out of bounds. (CIERR 9910)
setvar x x+x
Error executing commands in WHILE loop. (CIERR 10310)
988/COREDEV/TEMPTE:
------------------

these confirm what others have pointed out: the command-line length is 512 [or 511+CR] characters, and "string" variables are limited to 1024 characters

> !mpex

Ahhh... now the story changes somewhat...

>  SETVAR BIO ' '
>  SETVAR FNUM VEFOPEN('xxxxxxxx.BACKUP.xxxxxxxx,OLD')
>  WHILE VEFREADV('BIO',FNUM)

As was also mentioned, MPEX may be limiting FREADs to 256 characters, however the manual was written at a time when 256 really was the limit -- I don't know for certain whether or not the VESOFT programmer ever increased this limit.

***** HOWEVER *****

MPEX does allow for something known as "expression files" -- basically, "command" files that operate wholly in the context of "an expression", meaning you can change (bend) the rules a little -- you CAN create strings longer than 1024 characters, you CAN work with "date" variables [and they retain the fact that "they are a date"], and (I believe) you CAN read more than 256 characters with VEFREAD

However to the however: this whole thing smacks of using a screwdriver as a chisel (or a hammer) -- yes, it CAN be made to work in that manner, but it isn't really the proper tool for the job.  It sounds like your eventual target is a "posix" file -- as much as I like to promote MPEX for getting things done, perhaps you should look into posix-land tools from the start [awk, sed, & grep are the "core" you'll most likely hear about] but often you end up with the same problem [i.e., now you have a "hammer" instead of a "screwdriver" that you are using to hammer in some carpet tacks, however the "hammer" happens to be a 5-lb sledge... ;) ]

To be honest, I would emphasize the use of a "traditional" 3gl language [COBOL, fortran, pascal, "C", or even >gasp< BASIC] -- ALL of these are geared towards file I/O (processing) and string/substring handling (though I'll admit it can be "rough" in one or two of these) and have the advantage of being COMPILED rather than INTERPRETED  (errr, there IS a BASIC compiler, right? ;) ).  IMO, command-line file I/O is really only good for ad-hoc or prototype situations, not base-your-business-life-on-them routines...

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2