Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ISREDIT and combining two lines into one line

Status
Not open for further replies.

TSSSYSPROG

Technical User
Jan 26, 2010
5
US
EDIT XXXX.XXXXPDS.TSS.CMD.INPUT(TWO) - 01.41 Columns 00001 00072
Command ===> ________________________________________________________ Scroll ===> CSR
****** ***************************** Top of Data ******************************************
000001 TSS CRE(TESTacid) NAME('Test acid definition') TYPE(USER) -
000002 dept(scodept) pass(afge7lmn,0)
****** **************************** Bottom of Data ****************************************

Having trouble with ISREDIT in trying to combine line one with line two in an ISREDIT session as shown (at the - minus sign or continuation).

The new line would be:
****** **********************************************************************
000001 TSS CRE(TESTacid) NAME('Test acid definition') TYPE(USER) dept(scodept) pass(afge7lmn,0)
****** **********************************************************************

The length of the line is 255 characters for both lines.

File statistics:

Organization . . . : PO
Record format . . . : VB
Record length . . . : 255
Block size . . . . : 27998

 
Do you want to do this programmatically with REXX, or are you just struggling with the TS line command? What is the problem/symptom you are getting, or do you just want to know how to do it?

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Hi Steve,

I am having a problem with the contination to the next line on the exec when issuing a TSS or TSO command. What we do is issue TSS or TSO commands from a PDS member using $RUN and then we trap the output. The PDS member is up to 255 characters long for each line, but some commands are continued to the next line in the member.

The error we are getting is:

Command ===> TSS CRE(TESTacid) NAME('Test acid definition') TYPE(USER) -

TSS0242E UNKNOWN KEYWORD - -
TSS0301I TSS FUNCTION FAILED, RETURN CODE = 4
Error occured on this command ==> TSS CRE(TESTacid) NAME('Test acid definition'
) TYPE(USER) -

Return Code = 4

---------------------------------------------------------

Command input:

Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 TSS CRE(TESTacid) NAME('Test acid definition') TYPE(USER) -
000002 dept(scodept) pass(afge7lmn,0)
****** **************************** Bottom of Data ****************************


-------------------------------------------------------

/* REXX ($RUN) */
/* DESCRIPTION: EDIT AND EXECUTE ALL TSO & TSS COMMANDS */
/* IN PDS MEMBER */
/* USES REXX $RUNCMD AS SUB ROUTINE */
/* THANKS TO JOHN COFFEY FOR HELP WITH OUTTRAP */
/* 2009/12/22 AUTHOR: JIM SMITH - OFFICE OF THE STATE CONTROLLER */
/* BOISE, IDAHO */

/* TRACE ALL */

IF SYSVAR(SYSENV) = "BACK"
THEN DO
SAY "* ----------------------------------------- *"
SAY "* $RUN ONLY EXECUTES UNDER ISPF/TSO *"
SAY "* EDIT OR VIEW *"
SAY "* ----------------------------------------- *"
EXIT 12

END

ADDRESS ISREDIT
"MACRO"

SIGNAL ON FAILURE
SIGNAL ON SYNTAX
/* SIGNAL ON ERROR */

CALL MAIN_ROUTINE

RETURN

/*-------------------------------------------------------------------*/
/*- HANDLE ANY PROBLEMS ENCOUNTERED -*/
/*-------------------------------------------------------------------*/

FAILURE: SAY "FAILURE OCCURED ON LINE" SIGL; CALL CLEANUP;
SYNTAX: SAY "SYNTAX ERROR ON LINE" SIGL; CALL CLEANUP;
/* ERROR: SAY "COMMAND FAILED " SIGL; CALL CLEANUP; */

/*--CLEANUP ROUTINE ------------------*/
CLEANUP:

ADDRESS ISREDIT

"MACRO"

"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"================================================================="""
"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"$RUN HAS FAILED"""
"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"ONE COMMAND IN THIS PDS MEMBER FAILED"""
"LINE_BEFORE .ZFIRST = NOTELINE "" " ,

"PLEASE CHECK FOR VALID TSO/TSS COMMANDS"""
"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"================================================================"""
"LOC 0 "
ADDRESS "ISPEXEC" " SETMSG MSG(ISRZ000)"

EXIT 12

/*--MAIN ROUTINE ---------------------*/
MAIN_ROUTINE:

ADDRESS ISPEXEC "CONTROL ERRORS RETURN"

ADDRESS ISREDIT

"EX X'5C' 1 1 ALL" /* EXCLUDE ALL '*' IN COL 1 */
"DEL X ALL"

"RESET" /* RESET ALL */
"SAVE"

RETCDE = RC

IF RETCDE > 19
THEN DO
SAY "* ----------------------------------------- *"
SAY "* $RUN ONLY EXECUTES UNDER ISPF/TSO *"
SAY "* EDIT OR VIEW *"
SAY "* ----------------------------------------- *"
EXIT 12
END

"(TOP) = LINENUM .ZFIRST" /* SAVE FIRST ROW LINE NUMBER */
"(BOT) = LINENUM .ZLAST" /* SAVE LAST ROW LINE NUMBER */
IF BOT > 50
THEN SAY "PLEASE WAIT"
ADDRESS TSO


/* ALLOCATE TEMP FILE FOR VIEWING OUTPUT */
DDNM = 'DD'||RANDOM(1,99999) /* CHOOSE RANDOM DDNAME */
JUNK = MSG(OFF)
"ALLOC FILE("||DDNM||") UNIT(VIO) NEW TRACKS SPACE(5,5) DELETE",
" REUSE LRECL(140) RECFM(F B) BLKSIZE(8960)"
JUNK = MSG(ON)

/* ISSUE TSO COMMAND(S) AND TRAP OUTPUT */

JUNK=OUTTRAP('LINE.')

'$RUNCMD'

JUNK=OUTTRAP('OFF')

/* VIEW OUTPUT OF COMMANDS */


"EXECIO" LINE.0 "DISKW" DDNM "(STEM LINE. FINIS"
ADDRESS ISPEXEC "LMINIT DATAID(TEMP) DDNAME("||DDNM||")"
ADDRESS ISPEXEC "VIEW DATAID("||TEMP")"
ADDRESS ISPEXEC "LMFREE DATAID("||TEMP")"

/* DISPLAY LINES OF OUTPUT COUNT */

ADDRESS ISREDIT

"MACRO"

"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"================================================================="""
"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"$RUN HAS COMPLETED"""
"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"COMMANDS EXECUTED COUNT IN UPPER RIGHT HAND CORNER """
"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"PRESS PF1 FOR LONG MESAGE; PRESS PF3 OR QQ TO QUIT """
"LINE_BEFORE .ZFIRST = NOTELINE "" " ,
"================================================================"""
"LOC 0 "
ADDRESS "ISPEXEC" " SETMSG MSG(ISRZ000)"

CMDCNT = BOT - TOP + 1
ZERRSM = CMDCNT '= CMDS EX'
ZERRLM = CMDCNT "= COMMANDS EXECUTED"
ZERRALRM="NO"
ZERRHM="*"
ADDRESS 'ISPEXEC' 'SETMSG MSG(ISRZ002)'

/* FREE ALLOCATION OF TEMP FILE */
ADDRESS "ISPEXEC" "FREE FI("||DDNM||")"

RETURN

-----------------------------------------------
$RUNCMD is another REXX exec that is called from $RUN

 
OK... The problem is that your input command stack is not really ready to be processed; that is: it still contains dashes that will kill your process.

You must pre-process the input command stack to make it 'ready'.

My preferred method is to process the stack top-down asking for each row "does this row end with a dash?". When the answer is 'yes', chop the dash, and splice the next line in its place, then ask "does this line end with a dash?"

Only when the answer is 'no' do you write the line to the output command stack.


Frank Clarke
--America's source for adverse opinions since 1943.
 
My thanks to Frank and Steve for thier responses. I think that Frank is correct and I can delete the "-" (dash) and then concatenate the next line to the first line and then delete the second line after I place it on the end of the first line. I found an example of how to do the concatenate in another REXX exec on the CBT.org web site. The REXX exec there used the REXX function of "||" to put the two lines together using the substr command with it. I am fairly new to REXX and did not think of the concatenate function.
 
You do not really need to use ||. You can concatenate by abutment e.g.

fish = 'salmon'
Say 'I caught a 'fish

displays

I caught a salmon

on the screen
 
Chnages were made to add a called routine to the REXX statements shown before:

/* --CONCAT--------------------------- */
CONCAT:

"(START) = LINENUM .ZFIRST"
"(END) = LINENUM .ZLAST"

LAST = END + 1
PNTR = START
DO WHILE PNTR < LAST
"(RECORD) = LINE &PNTR"
IF POS("-",RECORD) > 0 THEN /* ONLY IF CONTINUATION */
DO
NXTPNTR = PNTR + 1
"(NXTREC) = LINE &NXTPNTR"
RECORD = SUBSTR(RECORD,1,72) || NXTREC
"DELETE &NXTPNTR"
END
"LINE &PNTR = &STR(RECORD)"
PNTR = PNTR + 1
END

RETURN
 
But you're not deleting the dash. "SUBSTR(RECORD,1,72)" includes the dash.

Try
Code:
address ISPEXEC
wordct = Words( record )    /* how many words? */
if Word( record,wordct ) = "-" then do /* last is dash? */
   front = Words( record,wordct-1 )   /* SNIP! */
   pntr = pntr + 1           /* next line */
   "(record) = LINE" pntr    /* get text */
   record = front record     /* splice */
   "DELETE" pntr             /* delete pt-2 */    
   pntr = pntr - 1           /* previous line */
   end
"LINE" pntr "= (record)"

Frank Clarke
--America's source for adverse opinions since 1943.
 
Good catch Frank!! I am deleting it in another step because I am calling routine CONCAT. But I should have deleted it as you have shown.

Thnak for all of the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top