In a message dated 06-04-97, John Wood said to All about Mainframe-pc Data
JW>There was a suggestion NOT to use CRLF when downloading, but when I
JW>leave this option off, having downloaded from mainframe to PC using a
JW>3270 terminal emulator, I always get
JW>IBM0843I Oncode=1042 A record in the dataset was not properly delimited
JW>but using CRLF its OK and I do not seem to see the 0A0D delimiter
This is because you haven't specified TYPE(LL). You'll never see the '0D0A'X
delimiter because it is swallowed by the run-time library when you use the
default TYPE(TEXT). Leaving the CR/LF pairs in the data is a bug waiting to
bite you, IMHO.
JW>I compiled the sample VRECGEN.PLI on the mainframe and "unloaded" my VB
JW>file to a new file which I then downloaded. The comments about CRLF
JW>How should I now access this file? The suggestion to use TYPE(LL) which
JW>I presume goes on the SET DD:.........,TYPE(LL) assignment just seems to
JW>give me protection exceptions.
The TYPE(LL) option can go on the SET DD: statement or in the TITLE() option
of the OPEN. I prefer the latter on largely aesthetic grounds.
If there had been anything syntactically wrong with your SET options, it
should have raised UNDEFINEDFILE() on the offending file. Were the
protection exceptions in your code or the RTL? Did they occur on OPEN or
JW>I tried using READ FILE(DBDUMP) SET(mypointer) and the program hangs
JW>until I press CTRL-BREAK. Should I be using record or stream I/O, or
JW>should it not matter?
With binary fields you'll be better off using RECORD transmission.
JW>I have included my code below to read the first record. Please feel free
JW>to improve on it
JW>pli test3.pli (source attributes(full) options list
[You might care to do a bit of RTFM on the DD options on the workstation.
There is no format-1 DSCB under Win 95.]
JW>*PROCESS LANGLVL(SAA2 OS2) gostmt DEFAULT(nonnative) AG X;
JW> Test3: PROCEDURE( PARMS ) OPTIONS( MAIN ) REORDER;
The REORDER option nows goes in the OPTIONS() list. [Although the old style
is tolerated by the compiler.]
JW> Dcl dbdump FILE STREAM;
DCL dbdump FILE RECORD;
JW> display('version 1.2 parms(' || parms || ')');
JW> OPEN FILE(dbdump) INPUT;
JW> GET file(dbdump) EDIT(INAREA) (a(32));
READ FILE(dbdump) INTO(HDR_SEP);
JW> x=addr(pattern); y=addr(pattern); z=13; call pliascii(x,y,z);
JW> put skip edit('pattern(',hdr_sep.pattern,')') (3 a);
JW> x=addr(version); y=addr(version); z=1; call pliascii(x,y,z);
JW> put skip edit('version(',hdr_sep.version,')') (3 a);
JW> x=addr(ddn); y=addr(ddn); z=8; call pliascii(x,y,z);
JW> put skip edit('ddn(',hdr_sep.ddn,')') (3 a);
JW> put skip edit('blkcnt(',hdr_sep.nblk,')') (a,f(9),a);
JW> put skip edit('blksize(',hdr_sep.blksize,')') (a,f(5),a);
Lots of calls to the stream output transmitter! Only one is needed. We can
also optimize the pointers x and y, and the integer z out of existance. The
LENGTH() values should be determined at compile time and PUSHed or MOVed as
constants. [This built-in is ideal for Optlink linkage under OS/2, probably
Fastcall under Win32, so I would guess the MOV instruction would be used,
rather than PUSH.]
PUT FILE(SYSPRINT) EDIT
The above will do all its printing for a record in a single starting and
terminating of the transmitter for SYSPRINT. [Assuming that the workstation
RTL uses file transmitter routines. Peter? Carolyn?]
Also, I like to declare SYSPRINT and name it explicitly in each PUT
statement. Furthermore, I like to open and close SYSPRINT explicitly, since
I can put overrides on the OPEN statement, such as PAGESIZE(), etc.
JW> CLOSE file(dbdump);
JW> DECLARE PARMS CHAR(100) VARYING;
JW> DECLARE (x,y) pointer;
JW> DECLARE z fixed bin(31);
This (z) will be NONNATIVE too! (I.e. slower access.) But since we optimized
it out of existance above, it matters not. The 2 previous declares can also
go west (or into the bit bucket, or down the gurgler, wherever).
JW> DCL INAREA CHAR(32),
Not needed when you use RECORD transmission.
JW> 1 HDR_SEP based(ADDR(INAREA)) ,
Why not make just this structure NONNATIVE and let the other stuff run
faster? Drop the DEFAULT(NONNATIVE) compilation option. This then becomes:
DCL 1 HDR_SEP NONNATIVE,
JW> 2 VBLL fixed bin(15),
No longer needed with TYPE(LL).
JW> 2 PATTERN CHAR(13),
JW> 2 VERSION CHAR(1),
JW> 2 UNUSED CHAR(2),
JW> 2 DDN CHAR(8),
JW> 2 NBLK FIXED BIN(31),
JW> 2 BLKSIZE FIXED BIN(15);
JW> DECLARE (ADDR,LENGTH,NULL,SUBSTR,oncode,plidump) BUILTIN;
JW> DECLARE PLIASCII builtin;
You have no facility above for checking for "short" records, where a
spurious '0D0A'X has caused a record to be truncated. If you use RECORD
transmission, the RECORD(dbdump) condition will be raised if things are not
according to Hoyle. This will then show you if you have been bitten by using
the CR/LF option on the download.
* MR/2 2.25 #353 * Do vegetarians eat animal crackers?
Please remove the '$' in the from line before reply via email.
Anti-UCE filter in operation.