Page 1 of 1

FB vs VB

PostPosted: Tue Sep 22, 2015 2:14 pm
by tcpipman
I wrote a piece of code that takes files with records in a particular format and it parses it out the fields; checks them for constancy and spits out some commands. Originally it worked fine with VB files that and everything was fine. Then the customer changed to FB file format and the last field seemed to get fouled against my constancy checking.

Here is the original code piece that was at issue
DO WHILE part_of_record /= 0
parse var stack data_record.count (record_delim) stack /*pop the stack*/

IF debug_flag THEN CALL BUILD_LOG "DLD1002&&Popped the following off the stack:"data_record.count

count=count+1

part_of_record=POS(record_delim,stack) /*is there another part_o f_record*/

IF debug_flag THEN CALL BUILD_LOG "DLD1003&&POS Returned the the following:"part_of_record

IF part_of_record = 0 THEN DO
data_record.count = stack /*grab what is left*/
data_record.0 = count
IF debug_flag THEN CALL BUILD_LOG "DLD1004&&Final part of the stack is:"data_record.count
END
END /*Done breaking apart record */


Now the highlighted piece above was the issue.. I changed it to the following and it fixed the issue
data_record.count = strip(stack) /*grab what is left*/


However I am trying to understand why with a VB Record Formatted file would be treated differently then a FB record format. This is an academic exercise since probably it would have been best If I always use a strip on the last field of a record like this but I really want to understand why.

Re: FB vs VB

PostPosted: Wed Sep 23, 2015 2:00 am
by Akatsukami
Since you don't say exactly what the problem, we can't say exactly what caused it. A possibility (and it's only a possibility, of course) would be that you are doing strict equality checking; a string is equal, but not strictly equal, to an identical string with one or more spaces appended.

Re: FB vs VB

PostPosted: Wed Sep 23, 2015 6:55 pm
by tcpipman
So let me try again

I have a formatted record where the ; is the delimiter
X;YYYYY;ZZZZZZZ;AAAAA;MMDD

Where the last field is a Month and a day; Then the record comes from a Variable Block file I have no issues with my syntax checking. However when the record comes from a Fixed Block file the check fails saying that it was expecting a 4 digit number. I did a HEX On and both files have x'40' after the MMDD field. When my rexx code reads the record from the FB file it is persevering the x40s where when it is working with the VB file it is not. Again a simple STRIP() fixes the issue and allows it to work in both cases but trying to understand why REXX sees these two files differently.

Re: FB vs VB

PostPosted: Wed Sep 23, 2015 7:28 pm
by enrico-sorichetti
NOPE... REXX sees things in the right way
because VB and FB records are different

what You see is one of the quirks of ISPF,
for VARIABLE records it will show blanks from the end of record up to the maximum record length

Re: FB vs VB

PostPosted: Thu Sep 24, 2015 9:49 pm
by Pedro
You can see the actual content of the data by printing the data set.
//STEP1 EXEC PGM=ADRDSSU,REGION=7000K                       
//SYSPRINT DD SYSOUT=H                                       
//VOLID  DD UNIT=3390,DISP=SHR,VOL=SER=USR131               
//SYSIN DD  *                                               
  PRINT DATASET(PEDRO.TEMPVB.LIST) INDD(VOLID)           SHR
/*EOF                                                       

Actually, the result is more of a 'dump of' than a 'print of', but in ADRDSSU terms, print is what you want to see the data.