FB vs VB

IBM's Command List programming language & Restructured Extended Executor

FB vs VB

Postby tcpipman » Tue Sep 22, 2015 2:14 pm

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


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 /*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.
Posts: 11
Joined: Tue Sep 22, 2015 2:03 pm
Has thanked: 2 times
Been thanked: 0 time

Re: FB vs VB


Re: FB vs VB

Postby Akatsukami » Wed Sep 23, 2015 2:00 am

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Global moderator
Posts: 999
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 48 times

Re: FB vs VB

Postby tcpipman » Wed Sep 23, 2015 6:55 pm

So let me try again

I have a formatted record where the ; is the delimiter

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.
Posts: 11
Joined: Tue Sep 22, 2015 2:03 pm
Has thanked: 2 times
Been thanked: 0 time

Re: FB vs VB

Postby enrico-sorichetti » Wed Sep 23, 2015 7:28 pm

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
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
Global moderator
Posts: 2501
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 119 times

Re: FB vs VB

Postby Pedro » Thu Sep 24, 2015 9:49 pm

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  *                                               

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.
Pedro Vera
User avatar
Posts: 536
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 34 times

Return to CLIST & REXX