Dear All
I have a task to remove # if it used as first character in the name of variable from all the object in all the libraries.I am aware of scan utility to do…the online option and tried with JCL but it failed everytime.Could anyone help me with a way to extract all the modules having # as the first character in the variables?
Thanks
Regards
Sarabjeet Pal
I’m really interested in knowing why you want to remove the character #. You may run into difficulties.
When you remove the charcter #, a user defined variable may become:
-
a natural reserved field, e.g. #ADD becomes ADD. How is your compiler option KCHECK (keyword checking) set?
-
a DDM field name. If the variable is used within a database access loop, Natural handles the DDM field as a user defined field or vice versa. There is a warning in the Natural documentation, but I can’t remember where.
When you remove the character # in the sample below
DEFINE DATA LOCAL
1 MYVIEW VIEW OF EMPLOYEES-DBA
2 NAME
2 INCOME (40)
3 SALARY
*
1 #NAME (A20)
1 #ADD (P10)
END-DEFINE
*
READ MYVIEW BY NAME
IF NAME = #NAME
ADD #ADD TO SALARY (1)
END-IF
END-READ
END
your new code would look like the following sample.
DEFINE DATA LOCAL
1 MYVIEW VIEW OF EMPLOYEES-DBA
2 NAME
2 INCOME (40)
3 SALARY
*
1 NAME (A20)
1 ADD (P10)
END-DEFINE
*
READ (10) MYVIEW BY NAME
DISPLAY NAME
IF NAME = NAME
ADD ADD TO SALARY (1)
END-IF
END-READ
END
Hi Helmut
Nice questions, will try to explain, Please let me know in case you have further quires.
We are working in Denmark and would like to used Danish character like Ø,Æ,Å and now latest code page which is used to set character does support danish charcter and # together so we need to get rid of # so that if any change required in future we can compile the code.
Thanks
Regards
Sarabjeet Pal
Hi Sarabjeet,
the SCAN command is no help. You can only search/replace with option
ABSOL=N: the character # must stand alone to be found
ABSOL=Y: all words will be found, that contain a character # , eg. E#-HUGO
So you won’t get variables, that have # as the first charcter.
If you have to find/replace certain parts of variables, you can write your own program by using Natural APIs like USR1057N (Read a Natural source code into an array), USR0210N (Save, catalog or stow Natural object), USR1055N (List objects in a library) and others.
As far as I know, SAG offers a product called Natural Engineer to accomplish tasks like you have to do.
Just to add to Helmut’s list:
Some shops used prefixes of ## as well as just one #.
How are you going to distinguish the use of # in an alpha string?
Is this a time critical change? As big as the task is, could you do the entire change online rather than in batch? That would also help discover problems like Helmut identified.
I seem to recall seeing a code snippet that used the English pound symbol as the field name prefix instead of #. Perhaps you could do the same. Try it with your new code page.