View previous topic :: View next topic
|
Author |
Message |
RANGANATHAGOPAL
New User
Joined: 22 Oct 2007 Posts: 1 Location: chennai
|
|
|
|
How to remove . from mainframe datasets using selcopy code?
eg:-
in dataset a record is like that
Input
A.100.89.90.87MAINFRAME IS G.OD TO WORK.
My Expected Output In DAataset is
A100899087MAINFRAME ID GOD TO WORK |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
RANGA,
You can use the SQZ function with PREBALNK of DFSORT for your requirement. Also please search in this forum as this has been discussed before.
Quote: |
using selcopy code?
|
what is selcopy code? |
|
Back to top |
|
|
Nick Jones
New User
Joined: 28 Apr 2009 Posts: 13 Location: UK
|
|
|
|
The answer to the original question "How to remove . from mainframe datasets using selcopy code?"
I can see that this is an old post, but for those who haven't heard of SELCOPY or would like to see how this task is achieved using SELCOPY...
SELCOPY syntax to do this is as follows...
Code: |
read indd * Read next input record.
** Loop to remove dots from all positions of the record except the last. **
@dot = 1 * Initialise pointer to 1st byte of input record.
==loop==
if @dot < lrecl * Verify pointer is in the record data.
and pos @dot, lrecl = "." ptr=@dot * Find "." and upd pointer to this pos.
then move from @dot+1, lrecl to @dot * Shift remainder of record left 1.
then lrecl = lrecl-1 * Reduce the record length by 1.
then goto loop * Locate next "."
** Now cater for "." in last position of record. **
if pos lrecl = "."
then if lrecl = 1 * Length of record is 1.
then pos lrecl = " " * Blank. (Cannot have zero length record.)
else lrecl = lrecl-1 * Reduce record length by 1.
write outdd * Write the record without the dots to the output data set. |
|
|
Back to top |
|
|
Gousiya Mulla
New User
Joined: 02 Jun 2008 Posts: 87 Location: Bangalore
|
|
|
|
Hi Nick ,
Have tried your logic , but it did not work .
The output still shows the 'dots' .
I have added as below .
OPTION WORKLEN=9999
EQU IN-REC0 POS = 1
MAINPARA
READ INFILE INTO IN-REC0
IF POS LRECL = "."
THEN IF LRECL = 1
THEN POS LRECL = " "
ELSE LRECL = LRECL-1
WRITE OUTFILE FROM IN-REC0
GOTO MAINPARA
Is there any thing I am missing here ? |
|
Back to top |
|
|
Nick Jones
New User
Joined: 28 Apr 2009 Posts: 13 Location: UK
|
|
|
|
Gousiya,
It looks like you've missed out a large section of the code. (The section beginning =loop= for example.)
In this case, use of a WORKLEN is unnecessary.
Note that SELCOPY will automatically loop to the start of the control statements to read the next record so the "MAINPARA"/ "GOTO MAINPARA" is also unnecessary. (Process looping stops when EOF of INFILE is reached.)
I have, however, amended the code slightly since my last posting.
Try to copy/paste the code below into your ISPF (or other) Edit session and run the job again.
If you still have problems, email your SYSPRINT output to me at the SELCOPY support desk (email address is at the selcopy.com web site.)
Code: |
read indd * Read next input record.
** Loop to remove dots from all positions of the record except the last. **
@dot = 1 * Initialise pointer to 1st byte of input record.
==loop==
if pos @dot, lrecl = "." ptr=@dot * Find "." and upd pointer to this pos.
and @dot < lrecl * Verify pointer is in the record data.
then move from @dot+1, lrecl to @dot * Shift remainder of record left 1.
then lrecl = lrecl-1 * Reduce the record length by 1.
then goto loop * Locate next "."
** Now cater for "." in last position of record. **
if pos lrecl = "."
then if lrecl = 1 * Length of record is 1.
then pos lrecl = " " * Blank. (Cannot have zero length record.)
else lrecl = lrecl-1 * Reduce record length by 1.
write outdd * Write the record without the dots to the output data set. |
|
|
Back to top |
|
|
|