primary command to move characters in ISPF editor



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

primary command to move characters in ISPF editor

Postby LotharLochkarte » Wed Oct 12, 2011 4:14 pm

Hi!

Is there a primary command to move all characters in the columns 5 to 9 to the columns 1 to 5 for example?

I don't know any...

Thanks!
LotharLochkarte
 
Posts: 68
Joined: Fri Aug 27, 2010 6:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: primary command to move characters in ISPF editor

 

Re: primary command to move characters in ISPF editor

Postby enrico-sorichetti » Wed Oct 12, 2011 4:24 pm

not natively
I have somewhere a colmove edit macro, i' l try to find it and post it
cheers
enrico
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
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: primary command to move characters in ISPF editor

Postby dick scherrer » Wed Oct 12, 2011 10:00 pm

Hello,

After the "move" what values should be in cols 5-9?

Posting a bit of sample "before" and "after" data would clarify.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: primary command to move characters in ISPF editor

Postby LotharLochkarte » Thu Oct 13, 2011 11:44 am

If I have ABCDEF in the first 6 columns, I want to move the B to column 6 for example. So afterwards it should look like "A CDEB".
LotharLochkarte
 
Posts: 68
Joined: Fri Aug 27, 2010 6:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: primary command to move characters in ISPF editor

Postby enrico-sorichetti » Thu Oct 13, 2011 12:54 pm

Your clarification is , wether You like it or not, wrong ... not according to the first request
when You move something You MOVE it ...
You should have asked not for a simple move, but for a move with OVERLAY
here is a rexx edit macro which will MOVE and swap colums
save it two times in a library in the sysproc or sysexec concatenation
one time with a name like MOVECOLS/COLMOVE/... anything You like
the second time with a name like SWAPCOLS/COLSWAP/... anything You like as long as it contains the string SWAP
 ****** ***************************** Top of Data ******************************
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace "O"
 000005
 000006 _safemode = 0
 000007
 000008 Parse Source _sys _how _cmd .
 000009
 000010 If Sysvar(SYSISPF) \= "ACTIVE" Then Do
 000011    Say left(_cmd,8)"- Ispf is not active. Command not executed"
 000012    exit 4
 000013 End
 000014
 000015 call $ispex "CONTROL ERRORS RETURN"
 000016
 000017 if $isred("MACRO (ARGS) NOPROCESS ") \= 0 then do
 000018    zedsmsg = "Invocation ERROR"
 000019    zedlmsg = left(_cmd,8)"- Must be invoked as a MACRO"
 000020    call $ispex "SETMSG MSG(ISRZ001)"
 000021    exit 4
 000022 end
 000023 args = space(translate(args," ",","))
 000024 if words(args) \= 3 then do
 000025    zedsmsg = "Operands   ERROR"
 000026    zedlmsg = left(_cmd,8)"- missing From,Length,Dest operands"
 000027    call $ispex "SETMSG MSG(ISRZ001)"
 000028    exit 4
 000029 end
 000030 parse var args from len1 dest
 000031 if datatype(from) \= "NUM" | ,
 000032    datatype(len1) \= "NUM" | ,
 000033    datatype(dest) \= "NUM" then do
 000034    zedsmsg = "Operands   ERROR"
 000035    zedlmsg = left(_cmd,8)"- From,Length,Dest must be numeric"
 000036    call $ispex "SETMSG MSG(ISRZ001)"
 000037    exit 4
 000038 end
 000039
 000040
 000041 if  pos("SWAP",_cmd) > 0 then ,
 000042     len2 = len1
 000043 else ,
 000044     len2 = 0
 000045
 000046 if  from > dest then do
 000047     temp = from; from = dest; dest = temp
 000048     temp = len1; len1 = len2; len2 = temp
 000049 end
 000050
 000051 call $isred "(BND1 BND2) = BOUNDS"
 000052 if ( from < bnd1 ) | ,
 000053    ( bnd2 < dest+len2) then do
 000054    zedsmsg = "Bounds     ERROR"
 000055    zedlmsg = left(_cmd,8)"- From,Length,Dest outside BOUNDS"
 000056    call $ispex "SETMSG MSG(ISRZ001)"
 000057    exit 4
 000058 end
 000059
 000060 call $isred "PROCESS RANGE S"
 000061 if $isred("(LN1) = LINENUM .ZFRANGE") \= 0 then do
 000062    call $ispex "SETMSG MSG(ISRE040) "
 000063    exit 4
 000064 end
 000065 call $isred "(LN2) = LINENUM .ZLRANGE"
 000066 Do  l = ln1 to ln2
 000067     call $isred("(BUFF) = LINE" l )
 000068     str1 = substr(buff,from,len1)
 000069     str2 = substr(buff,dest,len2)
 000070     temp = ""
 000071     temp = temp || substr(buff,1,from-1)
 000072     temp = temp || str2
 000073     temp = temp || substr(buff,from+len1,dest-(from+len1))
 000074     temp = temp || str1
 000075     temp = temp || substr(buff,dest+len2)
 000076     if  _safemode then ,
 000077         call $isred "LINE_AFTER .ZLAST = DATALINE (TEMP)"
 000078     else ,
 000079         call $isred "LINE "l" = (TEMP)"
 000080 
 000081 End
 000082
 000083 zedsmsg = left(_cmd,8)"- Ended"
 000084 zedlmsg = ln2-ln1+1 " Lines changed"
 000085 call $ispex "SETMSG MSG(ISRZ001) "
 000086
 000087 Exit 0
 000088
 000089 /*  */
 000090 $tsoex:
 000091    tso_0tr = trace("O")
 000092    Address TSO arg(1)
 000093    tso_0rc = rc
 000094    trace value(tso_0tr)
 000095    return tso_0rc
 000096
 000097 /*  */
 000098 $ispex:
 000099    isp_tr = trace("O")
 000100    Address ISPEXEC arg(1)
 000101    isp_rc = rc
 000102    trace value(isp_tr)
 000103    return isp_rc
 000104 /*  */
 000105 $isred:
 000106    isr_tr = trace("O")
 000107    Address ISREDIT arg(1)
 000108    isr_rc = rc
 000109    trace value(isr_tr)
 000110    return isr_rc
 000111
 ****** **************************** Bottom of Data ****************************

TESTED AND WORKING
but ... remember UNDO is Your friend

it must be invoked as <macroname> FromColumn,FromLength,ToColumn
for the swap the From and the To columns meaning is clear
for a move its a bit more difficult to explain
the from is clear ...
the to/dest is a bit murky , the macro will shift things starting from that column
movecols xx,1,1
will start shifting from column 1 an makes things look as data inserted before that column
the look is natural for a move left, not the same for a move right
the column used is the one before the move, and after that everything will be shifted left
just pay attention in not being confused by the look of the data after using the macro

You example uses a wrong terminology
when You move... as the verb tells You move and the source disappears .

no... the macro does not do what You clarified in the second post
because I had written it before the <unclear clarification>
it behaves according to the MOVE logic which means MOVE not substitute with blanks
and also from common terminology it inserts the source somewhere in the middle
to get what You have asked for You should have asked for an OVERLAY facility

when I have time i' ll post a new macro which will OVERLAY,
it will substitute blanks only if I find a simple enough logic
cheers
enrico
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
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: primary command to move characters in ISPF editor

Postby LotharLochkarte » Thu Oct 13, 2011 7:00 pm

thank you very much for this exhaustive example!
LotharLochkarte
 
Posts: 68
Joined: Fri Aug 27, 2010 6:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: primary command to move characters in ISPF editor

Postby enrico-sorichetti » Fri Oct 14, 2011 12:18 pm

with the current naming the str. len. from dest relation is not clear
if You change the variable names
from ==> col1
dest ==> col2
the move/swap code will be more understandable
cheers
enrico
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
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post