"PUT SKIP DATA" and "PUT SKIP LIST"



IBM's cross-platform compiler PL/I for MVS, VM & VSE, OS/390 and Enterprise PL/I for z/OS

"PUT SKIP DATA" and "PUT SKIP LIST"

Postby Misha786 » Tue Jul 18, 2023 6:45 pm

Hello -

I tried a compile, load and go two ways -
One using double quotes to assign the value and one using a hex value.
In both cases the put skip data show two quotes (which is wrong) and the put skip list shows one quote (Which is correct).
Please help to understand if there is any specific reason why PUT SKIP DATA gives a extra quote that PUT SKIP LIST does not give.

SURNAME = 'O' || '7D'X || 'MALLEY';
PUT SKIP DATA(SURNAME);
PUT SKIP LIST(SURNAME);
SURNAME='O''MALLEY '; <---- Wrong (using PUT SKIP DATA)
SURNAME=O'MALLEY <---- Correct (using PUT SKIP LIST)

SURNAME = 'O''MALLEY';
PUT SKIP DATA(SURNAME);
PUT SKIP LIST(SURNAME);
SURNAME='O''MALLEY '; <---- Wrong (using PUT SKIP DATA)
SURNAME=O'MALLEY <---- Correct (using PUT SKIP LIST)

Thanks,
Misha
Misha786
 
Posts: 30
Joined: Fri Nov 27, 2020 12:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: "PUT SKIP DATA" and "PUT SKIP LIST"

Postby sergeyken » Tue Jul 18, 2023 7:17 pm

According to RTFM, PUT DATA is supposed to show the values in the form they would otherwise be assigned by PL/I statements, in program code.

PUT LIST is supposed to show the values in their finalized form, dedicated to end user.

So, you get exactly what is described in any PL/I manual.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: "PUT SKIP DATA" and "PUT SKIP LIST"

Postby Misha786 » Tue Jul 18, 2023 8:10 pm

Thanks Sergeyken for your response, I was trying to comprehend what you meant. So, was looking for it in PL1 manual but could not find.
However, Just want to elaborate a bit about the source of the Surname field - it comes from a DB2 table where the value is stored as O'Maley

So, if we assign SURNAME='O''Maley' , shouldn't PUT SKIP DATA(SURNAME) give us O'Maley instead of O''MALEY ? because with same value, PUT SKIP LIST(SURNAME) gives us O'Maley
Please if you explain in simpler way, it would be great.

Thanks,
Misha
Misha786
 
Posts: 30
Joined: Fri Nov 27, 2020 12:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: "PUT SKIP DATA" and "PUT SKIP LIST"

Postby sergeyken » Tue Jul 18, 2023 11:20 pm

Frankly, I do not understand, what is not clear in this issue?

List-Directed Output

The LIST option specifies list-directed output.

The PUT LIST statement causes each value specified by the output list to be written to the stream file without the use of a format item. Each value to be output is converted to a character-string value using the normal rules for converting to a character string given in the section Data Type Conversions.

If the original output value is a bit string, the resulting character string is enclosed in quotation marks and a B is appended to its right end.

With PUT LIST and PUT DATA, if a variable of type AREA or a structure containing elements of type AREA is used as an argument, <...> is output as its contents. This is because the actual contents of the contents of AREA in these cases is not readable.



Data-Directed Output

The DATA option specifies data-directed output.

The PUT DATA statement is equivalent to the PUT LIST statement, with the following differences:

An output-list item can be a scalar, element, array, or structure reference, not an expression. The reference may contain structure qualifiers and subscripts, but may not be locator qualified.

The dataname of each reference is written along with the value. This is done in the form dataname=value. If the value is an array, each element is written with its array name and the actual value of its subscript(s). If the value is a structure, each elementary member is written with its dataname fully qualified and with all subscripts at the end.

The dataname=value combinations are separated by spaces except when writing to a PRINT file, when each such item will be aligned on a TAB stop. A semicolon is written following the last value.

The data values are written, in most cases, just as they are in PUT LIST. However, for character data, the data value is always enclosed in quotes when it is written out.

A based variable in the output-list must be declared with an explicit pointer.


Since the data value is always enclosed in quotes then internal quotes MUST BE DOUBLED. Clear as a bell.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: "PUT SKIP DATA" and "PUT SKIP LIST"

Postby Misha786 » Tue Jul 18, 2023 11:26 pm

Thanks a lot Sergeyken for all these details !! Understood :)
Misha786
 
Posts: 30
Joined: Fri Nov 27, 2020 12:28 am
Has thanked: 0 time
Been thanked: 0 time


Return to PL/I

 


  • Related topics
    Replies
    Views
    Last post