[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

376.0. "DCL substring replacement - How can it be done?" by DSSDEV::HANNA () Thu Dec 18 1986 14:36

    I'm trying to copy a symbol containing control characters into the
    middle of another symbol containing control characters in DCL.
    I have two symbols like the ones created by code below.  My attempt
    was to use character replacement (sym[off,wid]:=).  What happens
    is that only two bytes of the eight byte replacement gets put into
    symbol "a" correctly.  The other six bytes are filled with spaces.
    Apparently, DCL stops copying correctly after it comes to a non-
    printable character.  Why is this? Shouldn't it work?  What is
    the easiest way to do this replacement?  Do I have to f$extract to
    extract and then concatenate back together?
    -John Hanna - Display Systems Software
    
    simple.com:
    
    $ a[0,32]=100
    $ a[32,32]=200
    $ a[64,32]=300
    $ a[96,32]=400
    $ a[128,32]=500
    
    $ b[0,32]=600
    $ b[32,32]=700
    
    $ show sym a
    $ show sym b
    
    $ a[4,8]:="''b'"
    $ show sym a
    
T.RTitleUserPersonal
Name
DateLines
376.1yes, you need F$EXTRACTSIERRA::OSMANand silos to fill before I feep, and silos to fill before I feepThu Dec 18 1986 17:1822
    Yes, my experience is that DCL is lacking in this area, and indeed
    you need to extract and piece back together.
    
    For example:
    
    	$ string = "yyyyy"
    	$ new_middle = "x""x"
    	$ string = f$extract(0,1,string) + new_middle + f$extract(4,1,string)
    
    If you attempt the above example with the
    
    	$ string[...]:=
    
    construct, you run into trouble, either with the quote mark, or
    with inadvertant up-casing.
    
    The problem seems to be that DCL usually has both a "=" and a ":="
    construct, but it has "[]:=" but no "[]=".  Hence to get the
    privilege of "[]", you're forced into putting up with the vulgarities
    of ":=" (such as up-casing).
    
    /Eric