View previous topic :: View next topic |
Author |
Message |
rsivananda Beginner
Joined: 11 Aug 2004 Posts: 30 Topics: 10
|
Posted: Thu Sep 29, 2005 6:46 am Post subject: Easytrive-Remove bad char from inout flat file |
|
|
Hi
We have the following req:
1.we have a inout record file file1
2. we have a special char file file2 (This file has special char such as * ) & ^ etc
we need to read the input record from file1 and check if byte 40-150 has any bad char defined in file2
My soln: i am reading 40-150 record into one array and comparing each element of erray with all chars in special file.
But this req positioning cursor back to first rec in file2 which i amunable to do so
I know this code is going to add a lot of overhead.Plz let me know if there is any better way of doing this. |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Sep 29, 2005 6:55 am Post subject: |
|
|
rsivananda,
You can achieve this using sort. But I need the following info before I can go with the code.
1. What should be done when there is a bad/special character in pos 40 - 150 ? Should the record be rejected ?
2. What is the LRECL and RECFM of your input files (1 & 2).
3. If possible give us a sample input and sample output.
Thanks,
Phantom |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Sep 29, 2005 7:10 am Post subject: |
|
|
rsivananda,
How are many records do you have in your special char file and what is the LRECL and RECFM of the file?
Phantom,
I am not sure as to how you are thinking of solving thru sort. Remember that you need to validate 110 bytes each individually.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
rsivananda Beginner
Joined: 11 Aug 2004 Posts: 30 Topics: 10
|
Posted: Thu Sep 29, 2005 7:20 am Post subject: |
|
|
Hi
When ever in 40-150 has any special char that pos should be replaced by spaces,
and copied to output file.
The input records would be around 5000 but may increase depending on transactions.
Input file1:
RECFM=FB
LRECL=308
Sample partial input(27 chars)
202691093Bank Of XXX..
202691093Bank Of XXX..
202691093Bank Of XXX..
202691093Bank Of XXX
202691093Bank Of XXX
This is partial input file whihc has first 3 records gaving bad char at end which needs to be replaced by spaces and all clean fice records should be in output.
The last two dots when i saw in hex form are X'0D' and X'25'. |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Sep 29, 2005 7:33 am Post subject: |
|
|
Kolusu,
Quote: |
I am not sure as to how you are thinking of solving thru sort. Remember that you need to validate 110 bytes each individually.
|
I was actually hoping that she would ask me to reject those records (which have invalid chars). This could be done using INCLUDE/OMIT and SS parameters.
But what about ALTSEQ ? Using file 2, we can generate a dynamic control card to convert all special characters to spaces. Thoughts ???
rsivananda,
Kolusu asked you:
Quote: |
How are many records do you have in your special char file
|
Does it contain 5000 records ??? I hope not !
Can you tell us what Sort product (DFSORT / Syncsort) you are using and its version. To get the version, just write a dummy sort step, go to the sysout and paste the 1 line of sysout.
Method: 2
Why not write a small COBOL program and use INSPECT REPLACING ???
Code: |
01 WS-INPUT-RECORD.
05 WS-DATA1 PIC X(39).
05 WS-DATA2 PIC X(111).
05 WS-DATA3 PIC X(158).
.....
PROCEDURE DIVISION.
MAIN-LINE.
INSPECT
WS-DATA2
REPLACING
ALL invalid-char1 BY SPACES
ALL invalid-char2 BY SPACES
....
STOP RUN.
|
For this, you may have to create an COBOL Table/Array to hold the invalid characters from File 2 and use Table entry in INSPECT.
Hope this helps,
Thanks,
Phantom |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Sep 29, 2005 7:47 am Post subject: |
|
|
Phantom,
Using ALTSEQ with Sort is a good option. But that also depends on the number of records in FILE2.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
rsivananda Beginner
Joined: 11 Aug 2004 Posts: 30 Topics: 10
|
Posted: Thu Sep 29, 2005 7:50 am Post subject: |
|
|
Hello
We assumed all possible special chars which are 26.
We use SYNCSORT and we were asked to use a easytrieve.
Let us know if sysnsort solves the purpose. |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Sep 29, 2005 7:54 am Post subject: |
|
|
rsivananda,
Quote: |
We use SYNCSORT and we were asked to use a easytrieve.
Let us know if sysnsort solves the purpose.
|
You can get this done using Syncsort. If you are asked to do this using Easytrieve, then is it ok to provide a syncsort solution.
Also, some older versions of syncsort does not support ALTSEQ in OUTREC Statement. So, please post the Syncsort version you are running on. Meanwhile, I will write the code and get back to you.
Thanks,
Phantom |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Sep 29, 2005 8:01 am Post subject: |
|
|
Kolusu,
Can you give him an Eazytrieve solution. I am not good in easytrieve.
Thanks,
Phantom |
|
Back to top |
|
 |
rsivananda Beginner
Joined: 11 Aug 2004 Posts: 30 Topics: 10
|
Posted: Thu Sep 29, 2005 8:02 am Post subject: |
|
|
HI
We were asked to write code in easytreieve
Beause of the overhead it has,we are planning to use sysnsort.
any solution is ok |
|
Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Thu Sep 29, 2005 8:13 am Post subject: |
|
|
Sorry sorry.
It should be "equql to".
$$DD01 DROP IF=(field-position, field-length, EQ'*')
After dropping all such records, we can pad these positions with spaces right. |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Sep 29, 2005 8:35 am Post subject: |
|
|
rsivananda,
This should solve your requirement.
[code:1:31f0f7c655]
//STEP0100 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILE1 DD *
202691093BANK OF XXX*-XXX!XXX%XX |
|
Back to top |
|
 |
rsivananda Beginner
Joined: 11 Aug 2004 Posts: 30 Topics: 10
|
Posted: Thu Sep 29, 2005 8:37 am Post subject: |
|
|
Syncsort version using in our shop.
SYNCSORT FOR Z/OS 1.1BN TPF2B U.S. PATENTS: 4210961, 5117495 (C) 2002 SYNCSORT INC. DATE=2005/269 TIME=06.22.52 |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Sep 29, 2005 8:40 am Post subject: |
|
|
vkphani,
Code: |
$$DD01 DROP IF=(field-position, field-length, EQ'*')
|
Are you referring to File-Aid or any other tool. When you answer something, explain what you are trying to do. A 1 line code is good for nothing unless others know the syntax of the tool you are referring to.
Also, you said
Quote: |
we can pad these positions with spaces right
|
Look at my example. The special characters are embedded within valid values. It could be 'X' or anything else. If you Drop the char and pad the spaces will be padded at the end and the columns get re-arranged. Isn't it ? (You will get all Xs together followed by a string of spaces).
Thanks,
Phantom |
|
Back to top |
|
 |
rsivananda Beginner
Joined: 11 Aug 2004 Posts: 30 Topics: 10
|
Posted: Thu Sep 29, 2005 8:43 am Post subject: |
|
|
Apologies to Phantom for not responding to that question on file2
I thought it's file1 alone.
anyway i am checking with the code u have sent and will get back to u |
|
Back to top |
|
 |
|
|