View previous topic :: View next topic |
Author |
Message |
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Thu Feb 23, 2023 6:31 am Post subject: Unpacked data - Replace special characters with zeroes |
|
|
Hi,
I have unpacked around 98 COMP-3 fields into a dataset and finding below given special characters in the unpacked data (output LRECL=900).
Code: | Ā ā Ă ă Ą ą Ć ć Ĉ ĉ Ċ ċ Č č Ď ď Đ đ Ē ē Ĕ ĕ Ė ė Ę ę Ě ě Ĝ ĝ Ğ ğ Ġ ġ Ģ ģ Ĥ ĥ Ħ ħ Ĩ ĩ Ī ī Ĭ ĭ Į į İ ı IJ ij Ĵ ĵ Ķ ķ ĸ Ĺ ĺ Ļ ļ Ľ ľ Ŀ ŀ Ł ł Ń ń Ņ ņ Ň ň Ŋ ŋ Ō ō Ŏ ŏ Ő ő Œ œ Ŕ ŕ Ŗ ŗ Ř ř Ś ś Ŝ ŝ Ş ş Š š Ţ ţ Ť ť Ŧ ŧ Ũ ũ Ū ū Ŭ ŭ Ů ů Ű ű Ų ų Ŵ ŵ Ŷ ŷ Ÿ Ź ź Ż ż Ž ž ſ |
I am tasked to replace such special characters with zeroes. I read about FINDREP but not sure how to replace these many characters in the output file. We use Syncsort.
Please help. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Feb 23, 2023 4:05 pm Post subject: Re: Unpacked data - Replace special characters with zeroes |
|
|
mf_user wrote: | Hi,
I have unpacked around 98 COMP-3 fields into a dataset and finding below given special characters in the unpacked data (output LRECL=900). |
mf_user,
How did you unpack them? Looking from the data you posted, it still looks like packed data.
mf_user wrote: |
I am tasked to replace such special characters with zeroes. I read about FINDREP but not sure how to replace these many characters in the output file. We use Syncsort.
Please help. |
Why do you think they are special characters? Packed decimal data cannot be seen in display mode. If you want to see the data have the HEX ON and see the data.
What is your actual goal? Replacing the data does NOT make any sense. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Sat Feb 25, 2023 2:13 am Post subject: |
|
|
Hi Kolusu,
I have unpacked them using TO=ZD,LENGTH=n.
the downstream system wants the junk to be replaced with zeroes.
Thanks. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Sat Feb 25, 2023 10:07 am Post subject: |
|
|
mf_user wrote: | Hi Kolusu,
I have unpacked them using TO=ZD,LENGTH=n.
Thanks. |
mf_user,
I highly doubt it. If you did it, it would have shown displayable numbers and the sign overpunched on to the last digit. But I still see the packed decimal values.
Show us the complete control cards. You said "unpacked around 98 COMP-3", so did you have 98 TO=ZD statements? Did you use BUILD or OVERLAY ? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Sun Feb 26, 2023 1:01 am Post subject: unpack comp-3 |
|
|
Hi Kolusu,
After further analysis, and due to frequent S0C7 abend on certain fields (invalid input data from input file), we had to go for program approach. Declared an input filed of X(105) with all these characters and an output filed with 105 zeroes and used INSPECT to replace all such characters with zeroes.
since they asked us to ignore sign field, we did not consider it at all. Initial approach was SORT where I used OUTREC BUILD and tried TO=ZD, TO=ZDF, TO=ZDC and EDIT=() options.
However, I saw a post (either by you or Frank) few days ago in some forum or in google, where you provided a FINDREP solution (a bit lengthy though) and wanted to tell the possibility to client because its a onetime ask. I am not able to find that link /not able to recall where exactly I saw it. I will search for it again.
Unfortunately, I can't copy, paste the code as I could not copy it from RDP.
Please advise. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Sun Feb 26, 2023 10:20 am Post subject: |
|
|
mf_user,
I guess you are stuck on special characters and looking for the solution in that direction. Unfortunately nothing makes sense. Lets do something simple. lets just unpack 1 field.
Assuming 1 packed decimal filed starts at 10 for a length of 4 bytes. what is the output of this?
Code: |
OPTION COPY
OUTREC BUILD=(10,04,PD,TO=ZD,LENGTH=8)
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Mon Feb 27, 2023 6:37 am Post subject: |
|
|
Hi Kolusu,
Example with HEXON:
i/p:
Code: |
----1----2
.*.@
0537
1CFC
|
o/p:
So, as said, expectation is replace "Ü" with 0 and "." with 0.
o/p:
Thanks. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Mon Feb 27, 2023 6:42 am Post subject: |
|
|
sorry, I hit enter too soon...
sort card:
Code: |
1,4,PD,TO=ZD,LENGTH=7
|
o/p:
Code: |
----1----2
015Ü3.G0
|
Expected o/p:
Code: |
----1----2
01503000
|
_________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Mon Feb 27, 2023 5:40 pm Post subject: |
|
|
mf_user,
X'015C3F7C' is not a valid packed decimal number. Did you receive this file from an ASCII(windows/linux/mac) source? When converting ASCII code to EBCDIC code, all ASCII code not having an EBCDIC equivalent is converted to X'3F'.
That explains as to why you are getting X'3F' in the middle.
As I said you need to fix the data rather than trying to change the value.
I believe that changing it X'3F' to X'00' will make the values incorrect. Find out what the right value is supposed to be. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Tue Feb 28, 2023 2:21 am Post subject: |
|
|
Kolusu,
Thanks for the suggestion.
We had that discussion and the expectation is to replace it with zeroes.
so, how do I replace bulk of it with FINDREP, please let me know.
Thanks. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Feb 28, 2023 8:15 am Post subject: |
|
|
mf_user,
You did NOT answer my question about the source of the data. If your intention is to replace the values , list all the invalid values as IN list and have X'00' as OUT List. So what is the problem. Look up the syntax of FINDREP in Syncsort manuals _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|