IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Tilde Characters Changing to COLONs in the Rexx Program


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
fuzzle_irfan

New User


Joined: 22 Oct 2021
Posts: 7
Location: US

PostPosted: Fri Oct 22, 2021 7:08 pm
Reply with quote

Greetings:

I have a file containing data elements delimited by Tilde characters. I read the file into my Rexx program using EXECIO command. When the data is stored in the stem, all tilde characters get replaced by colons (" : ").

The record in the file:

ISA~01~ ~01~ ~ZZ~CINTAS PD ~01~081590853

The record after it is read into the rexx program:

ISA:01: :01: :ZZ:CINTAS PD :01:081590853

Question:

Is there a way to keep tilde's as tilde's?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Fri Oct 22, 2021 10:07 pm
Reply with quote

Show the record in HEX-Mode (and make use of code tags when doing so).
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Sat Oct 23, 2021 12:02 am
Reply with quote

fuzzle_irfan wrote:
Greetings:

I have a file containing data elements delimited by Tilde characters. I read the file into my Rexx program using EXECIO command. When the data is stored in the stem, all tilde characters get replaced by colons (" : ").

The record in the file:

ISA~01~ ~01~ ~ZZ~CINTAS PD ~01~081590853

The record after it is read into the rexx program:

ISA:01: :01: :ZZ:CINTAS PD :01:081590853

Question:


Is there a way to keep tilde's as tilde's?
I would say: there is no way the tilde to change to anything by itself.

The chance is 100% that your code is somehow wrong, which is hidden by you from the forum. icon_exclaim.gif
Back to top
View user's profile Send private message
fuzzle_irfan

New User


Joined: 22 Oct 2021
Posts: 7
Location: US

PostPosted: Sat Oct 23, 2021 2:19 am
Reply with quote

Hex format of the input record:

CECAFFA4444444444AFFA4444444444AEEACCDECE4DC444444AFFAFFFFFFFFF
921101100000000001011000000000019913953120740000001011081590853

Here is the Rexx code:

/* Rexx */
trace 'o'

iPut = 'T09016B.TED.EDI.DATA'

"ALLOC DA('"||iPut||"') F(iFile) SHR REUSE"
"execio * diskr iFile (stem iRec. finis"

say iRec.1
exit
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Sat Oct 23, 2021 2:30 am
Reply with quote

Your SAY shows NOT what you have in your REXX code, but instead: what is allowed on TSO screen.

Check it like this:
Code:
say c2x(iRec.1)
Back to top
View user's profile Send private message
fuzzle_irfan

New User


Joined: 22 Oct 2021
Posts: 7
Location: US

PostPosted: Sat Oct 23, 2021 6:17 am
Reply with quote

Here is the output of " say c2x(iRec.1) "

C9E2C1A1F0F1A140404040404040404040A1F0F1A140404040404040404040A1E9E9A1C3C9D5E3C1E240D7C4404040404040A1F0F1A1F0F8F1F5F9F0F8F5F3

I see that X'A1' is intact. So I wonder why does it show as ':' when HEX is OFF. It even places ':' for X'A1' when I write it to a file. What can I possibly do to make sure that X'A1' is written as '~' both on TSO screen and to a file?
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2593
Location: Silicon Valley

PostPosted: Sat Oct 23, 2021 8:10 am
Reply with quote

Issue the TSO PROFILE command and show us the results. (do not know if it is useful... but the PLANGUAGE and SLANGUAGE settings might mean something)

Also, this translation might be an emulator setting.
Back to top
View user's profile Send private message
fuzzle_irfan

New User


Joined: 22 Oct 2021
Posts: 7
Location: US

PostPosted: Sat Oct 23, 2021 9:19 am
Reply with quote

I wanted to correct one of my previous statements. When I write the record read from the file to another file, the tilde gets written as tilde.

The affect of tilde being interpreted as a colon (icon_smile.gif in the program is that my parse command is not working correctly. Please see the code below and its results when it is executed:

Input Record Read in:

ISA~01~ ~01~ ~ZZ~CINTAS PD ~01~081590853 ~211019~

/* Rexx */
trace 'o'

iPut = 'T09016B.TED.EDI.DATA'

"ALLOC DA('"||iPut||"') F(iFile) SHR REUSE"
"execio * diskr iFile (stem iRec. finis"

d = substr(iRec.1, 4, 1)
say 'Delimiter is' d
if substr(iRec.1, 4, 1) = '~' then say 'Tilde recognized !!!'

parse var iRec.c w (d) w (d) w (d) w (d) w (d) w (d) cn (d) w (d) w (d) cd,
(d) w
say 'Company Name is' cn
say 'Company Code is' cd

exit


Results when the above code is executed:

Delimiter is :
Tilde recognized !!!
Company Name is
Company Code is
***


Below is the result of running TSO PROFILE:

IKJ56688I CHAR(0) LINE(0) PROMPT INTERCOM NOPAUSE MSGID MODE WTPMS
G NORECOVER PREFIX(T09016B) PLANGUAGE(ENU) SLANGUAGE(ENU) VARSTORAGE(LOW)
IKJ56689I DEFAULT LINE/CHARACTER DELETE CHARACTERS IN EFFECT FOR THIS TERMINAL
***
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Sat Oct 23, 2021 6:36 pm
Reply with quote

fuzzle_irfan wrote:
Here is the output of " say c2x(iRec.1) "

C9E2C1A1F0F1A140404040404040404040A1F0F1A140404040404040404040A1E9E9A1C3C9D5E3C1E240D7C4404040404040A1F0F1A1F0F8F1F5F9F0F8F5F3

I see that X'A1' is intact. So I wonder why does it show as ':' when HEX is OFF. It even places ':' for X'A1' when I write it to a file. What can I possibly do to make sure that X'A1' is written as '~' both on TSO screen and to a file?

I would ignore the TSO screen display character problem as a secondary one.
There are some screens, like SDSF output screen, where some good characters are considered as non-printable ones; let’s forget about them for the time being.
All characters should be written correctly to either a file, or a dataset.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Sat Oct 23, 2021 7:08 pm
Reply with quote

You can try to display the whole EBCDIC table to verify valid/invalid characters.
Like this
Code:
say xrange( ‘00’x, ‘FF’x )

Or, better, as 16x16 square table.
Code:
Do i = 0 To 15
   Say xrange( i*16, i*16+15 )
End i
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 420
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Sat Oct 23, 2021 8:02 pm
Reply with quote

Is parse var iRec.c … correct?
Back to top
View user's profile Send private message
fuzzle_irfan

New User


Joined: 22 Oct 2021
Posts: 7
Location: US

PostPosted: Sat Oct 23, 2021 8:56 pm
Reply with quote

In the Parse iRec.c statement, the index used with the stem should have been '1' not 'c'. Good catch!!! Thank you for pointing it out.
Back to top
View user's profile Send private message
fuzzle_irfan

New User


Joined: 22 Oct 2021
Posts: 7
Location: US

PostPosted: Sat Oct 23, 2021 9:07 pm
Reply with quote

Output of 'Say xrange ('00'x, 'FF'x )' follows:

::::::::::: :::::::::::: ::*:;::::::::::::::::::::::::::::::::: :::::::::¢.<(+
|&:::::::::!$*);¬-/::::::::¦,%_>?:::::::::::#@'=":ab
cdefghi:::::::jklmnopqr::::::::stuvwxyz:::::::::::::::::::::::ABCDEFGHI:::::::J
KLMNOPQR::::::::STUVWXYZ::::::0123456789::::::


Tilde is not included in the above.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Sat Oct 23, 2021 9:21 pm
Reply with quote

Now you should verify what codepage you are using.
Code:
/* REXX */
address ISPEXEC "VGET (ZTERMCP) ASIS"
say ZTERMCP
exit
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Sat Oct 23, 2021 10:09 pm
Reply with quote

Update: I just found this old thread https://bit.listserv.ibm-main.narkive.com/LbpFRvAn/tso-and-national-characters.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Sat Oct 23, 2021 10:14 pm
Reply with quote

fuzzle_irfan wrote:
Output of 'Say xrange ('00'x, 'FF'x )' follows:

::::::::::: :::::::::::: ::*:;::::::::::::::::::::::::::::::::: :::::::::¢.<(+
|&:::::::::!$*);¬-/::::::::¦,%_>?:::::::::::#@'=":ab
cdefghi:::::::jklmnopqr::::::::stuvwxyz:::::::::::::::::::::::ABCDEFGHI:::::::J
KLMNOPQR::::::::STUVWXYZ::::::0123456789::::::


Tilde is not included in the above.


So, this is the question of your display/codepage settings.
This is a secondary issue.

I would ignore it for a while, and continue working on your major goal.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Mon Oct 25, 2021 12:43 pm
Reply with quote

sergeyken wrote:
So, this is the question of your display/codepage settings.
This is a secondary issue.

I rather would say, it's how TPUT is working from what I have read so far.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Mon Oct 25, 2021 10:20 pm
Reply with quote

sergeyken wrote:
fuzzle_irfan wrote:
Output of 'Say xrange ('00'x, 'FF'x )' follows:

::::::::::: :::::::::::: ::*:;::::::::::::::::::::::::::::::::: :::::::::¢.<(+
|&:::::::::!$*);¬-/::::::::¦,%_>?:::::::::::#@'=":ab
cdefghi:::::::jklmnopqr::::::::stuvwxyz:::::::::::::::::::::::ABCDEFGHI:::::::J
KLMNOPQR::::::::STUVWXYZ::::::0123456789::::::


Tilde is not included in the above.


So, this is the question of your display/codepage settings.
This is a secondary issue.

I would ignore it for a while, and continue working on your major goal.


Before the display issue has been resolved, you can use for debugging and testing purposes something like
Code:
Say Translate( string, '¢', '~' )

with any displayable character which is rarely used.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Oct 29, 2021 10:57 pm
Reply with quote

I, too, have observed similar behavior, though with the \ character.

The data in the data set is fine; the problem is how Rexx displays the data. I cannot be certain here, but I'd bet Rexx uses the PUTLINE TSO service, and PUTLINE alters marginally displayable data such as the ~ character to :.

To test this I write a small program that uses PUTLINE to display some text. Sure enough,

THIS LINE CONTAINS ~ CHARACTERS

became

THIS LINE CONTAINS : CHARACTERS
Back to top
View user's profile Send private message
fuzzle_irfan

New User


Joined: 22 Oct 2021
Posts: 7
Location: US

PostPosted: Fri Oct 29, 2021 11:33 pm
Reply with quote

Thank you all for providing your valued input. My issue is now resolved.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Nov 01, 2021 9:56 pm
Reply with quote

Joerg.Findeisen wrote:
sergeyken wrote:
So, this is the question of your display/codepage settings.
This is a secondary issue.

I rather would say, it's how TPUT is working from what I have read so far.
First I thought the guity party was PUTLINE, then we have Mr. Findeisen claiming it's TPUT. So I put it to a test. I altered my testing program to use TPUT in addition to PUTLINE. Here is the program.
Code:
SAMPLE   CSECT                     Establish SAMPLE CSECT
         IKJCPPL                   Define the TSO CPPL data area
RUPT     EQU   6+(CPPLUPT-CPPL)/4  Register containing CPPLUPT
RECT     EQU   6+(CPPLECT-CPPL)/4  Register containing CPPLECT
         IKJIOPL                   Define the TSO IOPL data area
IOPLSIZE EQU   *-IOPL              Define the soze of an IOPL
SAMPLE   CSECT                     Return to the sample CSECT
         USING *,12                Establish SAMPLE addressability
         SAVE  (14,12),,*          Save registers
         LR    12,15               Prepare SAMPLE base register
         LR    15,13               Save area address to reg 15
         LA    13,SAVEAREA         Compute new save area address
         ST    13,8(,15)           Add new save area to the
         ST    15,4(,13)            save area chain
         LM    6,9,0(1)            Load CPPL intop regs 6 through 9
         PUTLINE MF=(E,MYIOPL),ECB=ECB,UPT=(RUPT),ECT=(RECT),  Write  ->
               PARM=PUTLPB,OUTPUT=(LINE,TERM,SINGLE,DATA)       line
         LA    0,LINEL-4           Load data length in line
         LA    1,LINE+4            Load address of the line data area
         TPUT  (1),(0)             Use TPUT to write the line
         L     13,4(,13)           Load address of the higher save area
         RETURN (14,12),RC=0       Restore registers & return
SAVEAREA DC    9D'0'               72 byte register save area
MYIOPL   DC    XL(IOPLSIZE)'0',0D'0'  My IOPL
PUTLPB   PUTLINE MF=L              PUTLINE parameter list
ECB      DC    F'0'                ECB for PUTLINE
LINE     DC    AL2(LINEL,0),C'THIS LINE CONTAINS A ~ AND A \'
LINEL    EQU   *-LINE
         DC    0D'0'
         END   SAMPLE

Here is the test run of the program.
Code:
test sample cp
 ENTER COMMAND FOR CP
z
 TEST
go
 THIS LINE CONTAINS A : AND A :
 THIS LINE CONTAINS A : AND A :
 PROGRAM UNDER TEST HAS TERMINATED NORMALLY+
 TEST
end
 READY

The only conclusion an analysts can make from this is TPUT definitely altered the ~ and \ characters,but what about PUTLINE.

To test this I prepared and ran this job.
Code:
//A       EXEC PGM=IKJEFT01
//SYSTSPRT DD  SYSOUT=*
//SYSTSIN  DD  *
TEST SAMPLE CP
Z
GO
END
This output appeared in SDSF
Code:
TEST SAMPLE CP
ENTER COMMAND FOR CP
Z
TEST
GO
THIS LINE CONTAINS A ~ AND A \
PROGRAM UNDER TEST HAS TERMINATED NORMALLY+
BREAKPOINTS SET ARE STILL VALID
TEST
END
READY
So, a reasonable analyst can conclude the PUTLINE did not alter the ~ and \ characters to :; it was TPUT.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Nov 05, 2021 8:36 pm
Reply with quote

TPUT messes with these characters -
Code:
~ A2
[ BA  These characters are heavily
] BB  code page dependent
{ C0
} D0
\ E0

I honestly don't know what code page my 3270 emulator is using.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Fri Nov 05, 2021 9:35 pm
Reply with quote

There is a real problem with special characters in different code-tables.

I've had a contract which included C/C++ code on zOS. There was a problem: actual characters '[' and ']' could not be handled by C++ compiler; all array operations had to be coded with replacements:
'[' ==> '??(', and
']' ==> '??)'

Quote:
Trigraphs

Trigraphs are certain character sequences starting with two question marks, which can be used instead of certain characters, and which are always and in all contexts interpreted as the replacement character. They can be used anywhere in the source, including, but not limited to string constants. The complete list is:

Trigraph Replacement letter
??( . . . . . [
??) . . . . . ]
??< . . . . . {
??> . . . . . }
??/ . . . . . \
??= . . . . . #
??' . . . . . ^
??! . . . . . |
??- . . . . . ~
Note that interpretation of those trigraphs is the very first step in C++ compilation, therefore the trigraphs can be used instead of their replacement letters everywhere, including in all of the following escape sequences (e.g. instead of \u00CF (see next section) you can also write ??/u00CF, and it will be interpreted the same way).

Also note that some compilers don't interpret trigraphs by default, since today's character sets all contain the replacement characters, and therefore trigraphs are practically not used. However, accidentally using them (e.g. in a string constant) may change the code semantics on some compilers, so one should still be aware of them.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts REXX/CMS How to place command console... CLIST & REXX 4
Search our Forums:

Back to Top