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

Problem with Backslash Character String \ in REXX and CLIST


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

New User


Joined: 10 Aug 2007
Posts: 2
Location: Oakland

PostPosted: Sat Aug 11, 2007 3:19 am
Reply with quote

Hello,

I am attempting a file transfer using the ISPF Worstation Connection. I have already successfully made the connection.

The problem is that the MS-DOS directory path is not being recognised within either a CLIST nor in REXX. The backslash character \ seems to be interpreted as an escape character. I have even tried the double backslash \\ to no avail. in both cases the script converts the backslash '\' to an asterisk '*'.

The result is the message "Workstation file does not exist" because an invalid filename is being presented.

I have my code examples below: a REXX script and a CLIST

Thanks!


===============================================

/*----- REXX ----------------*/
/* TRACE all */
/*-----------------------------*/

arg TSOCMD
/*address ISPEXEC "CONTROL ERRORS RETURN" */
address TSO

file = "C:\Documents and Settings\T881373\My Documents\Status Reports"
say file
dsn = sysvar('sysuid')||.ISPFCS.||'T'||random(1,99999)
address ISPEXEC "FILESTAT FILE(FILE) LRECL(MAXREC)"
maxrec = maxrec + 4
maxblk = maxrec * 100

"ALLOC DS('"dsn"') UNIT(VIO) NEW RECFM(V B)",
" LRECL("MAXREC") BLKSIZE("MAXBLK") TRACKS SPACE(5,5)"

address ISPEXEC "FILEXFER HOST(DSN) WS(FILE) TO(HOST) TEXT"
address ISPEXEC "BROWSE DATASET('"dsn"')"

"DELETE '"dsn"'"

===============================================

PROC 0
CONTROL MAIN ASIS FLUSH NOCAPS NOCONLIST NOLIST NOPROMPT NOSYMLIST
/*CONTROL MAIN ASIS CONLIST FLUSH LIST MSG NOCAPS PROMPT SYMLIST
/***********************************************************************

CLRSCRN
SET FILE = +
&STR(C:\Documents and Settings\T881373\My Documents\Status Reports)
SET DSN = '&SYSUID..ISPFCS.TEMP'
ISPEXEC VPUT (DSN FILE) SHARED

ISPEXEC CONTROL ERRORS RETURN
ISPEXEC FILESTAT FILE(FILE) LRECL(MAXREC)
SET &RETCODE = &LASTCC
SELECT (&RETCODE)
WHEN (0) WRITE Workstation file exists.
WHEN (4) WRITE Workstation file does not exist.
WHEN (8) WRITE Error in variable specification.
WHEN (10) WRITE No workstation connection exists.
WHEN (12) WRITE Workstation device is not ready.
WHEN (20) WRITE Severe error in FILESTAT service.
OTHERWISE
END
SET &MAXREC = &MAXREC + 8
SET &MAXBLK = &MAXREC * 100

ALLOCATE DATASET(&DSN) NEW UNIT(VIO) RECFM(V B) +
LRECL(&MAXREC) BLKSIZE(&MAXBLK) TRACKS SPACE(5,5)

ISPEXEC FILEXFER HOST(DSN) WS(FILE) TO(HOST) TEXT
SET &RETCD = &LASTCC
SELECT (&RETCODE)
WHEN (2) WRITE &STR( Source file and target file) +
&STR(have the same date and time.)
WHEN (4) WRITE LMSTAT failed.
WHEN (6) WRITE LMINIT failed.
WHEN (7) WRITE Error in variable specification.
WHEN (8) WRITE &STR("TO" direction not valid.)
WHEN (9) WRITE Host name is too long.
WHEN (10) WRITE No workstation connection exists.
WHEN (11) WRITE &STR(Return code 1 from DTTRANSFER.) +
&STR(Host data set had null object handle.)
WHEN (12) WRITE &STR(Return code 2 from DTTRANSFER.) +
&STR(Workstation file had null object handle.)
WHEN (13) WRITE &STR(Return code 3 from DTTRANSFER.) +
&STR(Host data set could not be opened.)
WHEN (14) WRITE &STR(Return code 4 from DTTRANSFER.) +
&STR(Workstation file could not be opened.)
WHEN (15) WRITE &STR(Return code 5 from DTTRANSFER.) +
&STR(Error reading host data set.)
WHEN (16) WRITE &STR(Return code 6 from DTTRANSFER.) +
&STR(Error reading workstation file.)
WHEN (17) WRITE &STR(Return code 7 from DTTRANSFER.) +
&STR(Error writing host data set.)
WHEN (18) WRITE &STR(Return code 8 from DTTRANSFER.) +
&STR(Error writing workstation file.)
WHEN (19) WRITE &STR(Return code 9 from DTTRANSFER.) +
&STR(Error closing host data set.)
WHEN (20) WRITE Severe error in transfer service.
WHEN (21) WRITE &STR(Return code 10 from DTTRANSFER.) +
&STR(Error closing workstation file.)
WHEN (22) WRITE &STR(Return code 11 from DTTRANSFER.) +
&STR(User refused file access.)
WHEN (23) WRITE Data set or member in use.
OTHERWISE
END

ISPEXEC BROWSE DATASET(&DSN)
SET &RETCODE = &LASTCC
SELECT (&RETCODE)
WHEN (0)
WHEN (12) WRITE Empty data set.
WHEN (14) WRITE Specified member not found.
WHEN (16) WRITE No members matched or found.
WHEN (18) WRITE VSAM processing not supported under ISPF.
WHEN (20) WRITE Severe error.
OTHERWISE
END

IF &SYSDSN(&DSN) = OK THEN DELETE &DSN

EXIT CODE(&MAXCC)


==============> CLIST EXECUTION RESULTS:


SET FILE = &STR(C::Documents and Settings:T881373:My Documents:Status Reports)
SET FILE = C::Documents and Settings:T881373:My Documents:Status Reports
SET DSN = '&SYSUID..ISPFCS.TEMP'
SET DSN = 'T881373.ISPFCS.TEMP'
ISPEXEC VPUT (DSN FILE) SHARED
ISPEXEC VPUT (DSN FILE) SHARED
ISPEXEC CONTROL ERRORS RETURN
ISPEXEC CONTROL ERRORS RETURN
ISPEXEC FILESTAT FILE(FILE) LRECL(MAXREC)
ISPEXEC FILESTAT FILE(FILE) LRECL(MAXREC)
SET &RETCODE = &LASTCC
SET &RETCODE = 4
SELECT (&RETCODE)
SELECT (4)
WHEN (0)
WHEN (0)
WHEN (4)
WHEN (4)
WRITE Workstation file does not exist.
***
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Aug 11, 2007 12:41 pm
Reply with quote

even though this example from the book is from host to ws, it saves the filenames in the variable pool, which you do not in your rexx script:
Code:

    /*  REXX  */
    VAR1 = 'MYMVS.FILE(STUFF)'
    VAR2 = 'E:\MYOS2.FILE'
    ADDRESS ISPEXEC 'VPUT (VAR1 VAR2)'
    ADDRESS ISPEXEC 'FILEXFER HOST(VAR1) WS(VAR2) TO(WS) TEXT'


would be interesting to see your trace output from the rexx. i stopped using clists 10 years ago because of conversion/translation problems (that I could not solve, took the easy way out and used rexx exclusively - but that is my problem).

You mentioned astrisk (*) but I only see colon ( : ) for the false conversion of the backslash (\) in the clist.

probably does not matter but when i googled for ascii/ebcdic conversion charts i did find one (from around 1999) that did not have the backslash (/) for ebcdic, though all the other conversion charts I found, did, ex1, ex2.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Aug 11, 2007 2:24 pm
Reply with quote

please use [code] and [/code] tags,it makes your posts easier to read. For info use this link for BBCode.
Back to top
View user's profile Send private message
James Jones

New User


Joined: 10 Aug 2007
Posts: 2
Location: Oakland

PostPosted: Mon Aug 13, 2007 10:41 pm
Reply with quote

Thanks, dbzTHEdinosauer for the quick reply.

Yes I meant to say that the backslash is being replaced with a colon rather than an asterisk.

I tried putting the values in the variable pool in the REXX script (as in the CLIST) and I'm getting the same results:


Code:

/*----- REXX ----------------*/                                       
/*                           */                                       
   TRACE all                                                         
/* TRACE all                 */                                       
/*---------------------------*/                                       
                                                                     
arg TSOCMD                                                           
address ISPEXEC "CONTROL ERRORS RETURN"                               
address TSO                                                           
                                                                     
FILE = 'C:\Documents and Settings\T881373\My Documents\Status Reports'
DSN = sysvar('sysuid')||.ISPFCS.||'T'||random(1,99999)               
address ISPEXEC 'VPUT (FILE DSN)'                                     
address ISPEXEC "FILESTAT FILE(FILE) LRECL(MAXREC)"                   
say file                                                             
say dsn
say maxrec                                                 
maxrec = maxrec + 4                                       
maxblk = maxrec * 100                                     
                                                           
"ALLOC DS('"dsn"') UNIT(VIO) NEW RECFM(V B)",             
" LRECL("MAXREC") BLKSIZE("MAXBLK") TRACKS SPACE(5,5)"     
                                                           
address ISPEXEC "FILEXFER HOST(DSN) WS(FILE) TO(HOST) TEXT"
address ISPEXEC "BROWSE DATASET('"dsn"')"                 
                                                           
"DELETE '"dsn"'"                                           
                                                             
=================== TRACE OUTPUT =================

                                               
       6 *-* /* TRACE all                 */         
       7 *-* /*---------------------------*/         
       9 *-* arg TSOCMD                             
     10 *-* address ISPEXEC "CONTROL ERRORS RETURN"
        >>>   "CONTROL ERRORS RETURN"                                           
     11 *-* address TSO                                                         
     13 *-* FILE = 'C::Documents and Settings:T881373:My Documents:Status Report
 s'                                                                             
     14 *-* DSN = sysvar('sysuid')||.ISPFCS.||'T'||random(1,99999)             
     15 *-* address ISPEXEC 'VPUT (FILE DSN)'                                   
        >>>   "VPUT (FILE DSN)"                                                 
     16 *-* address ISPEXEC "FILESTAT FILE(FILE) LRECL(MAXREC)"                 
        >>>   "FILESTAT FILE(FILE) LRECL(MAXREC)"                               
        +++ RC(4) +++                                                           
     17 *-* say file                                                           
 C::Documents and Settings:T881373:My Documents:Status Reports                 
     18 *-* say dsn                                                             
 T881373.ISPFCS.T4307                                                           
     19 *-* say maxrec                                                         
 00000000                                                                       
     20 *-* maxrec = maxrec + 4                                                 
     21 *-* maxblk = maxrec * 100                                               
     23 *-* "ALLOC DS('"dsn"') UNIT(VIO) NEW RECFM(V B)",                       
             " LRECL("MAXREC") BLKSIZE("MAXBLK") TRACKS SPACE(5,5)"             
        >>>   "ALLOC DS('T881373.ISPFCS.T4307') UNIT(VIO) NEW RECFM(V B)  LRECL(
 4) BLKSIZE(400) TRACKS SPACE(5,5)"                                             
     26 *-* address ISPEXEC "FILEXFER HOST(DSN) WS(FILE) TO(HOST) TEXT"         
        >>>   "FILEXFER HOST(DSN) WS(FILE) TO(HOST) TEXT"
        +++ RC(6) +++                                   
     27 *-* address ISPEXEC "BROWSE DATASET('"dsn"')"   
        >>>   "BROWSE DATASET('T881373.ISPFCS.T4307')"   
        +++ RC(20) +++                                   
     29 *-* "DELETE '"dsn"'"                             
        >>>   "DELETE 'T881373.ISPFCS.T4307'"           
 ENTRY (A) T881373.ISPFCS.T4307 DELETED
                 
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 14, 2007 12:55 am
Reply with quote

James,

I hesitate to say that you have an old/odd codeset on your MF. It could be your keyboard mapping from your emulator.

If I were you, I would write a quick rexx that saved to a variable pool every bit combination asc(00) to asc(255) and determine what hex value you have to use to generate a backslash.
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top