View previous topic :: View next topic
|
Author |
Message |
shymala
New User
Joined: 26 Jul 2018 Posts: 5 Location: india
|
|
|
|
Hi All,
I have a file which has a detail records and i am extracting the data for a particular field of pic x(16) which contains data+low values. The data in the field is varying for each record. If i do HEX ON i can see hexadecimal values in that. If I open the file in browse mode i can see the data as 123456789-12.....
o/p - i need to write only the data part(123456789-12) in the output file.
As of now i am using the solution as
1.inspect with replacing all low values by spaces
2. using reverse function i am trying to retrieview only the data part but i am failing at the count part.
Can anyone provide me the solution along with the code or explanation.
Thanks
Shyamala |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Your explanation is not clear at all
Quote: |
If i do HEX ON i can see hexadecimal values in that. If I open the file in browse mode i can see the data as 123456789-12..... |
Should I assume when you use HEX on it is low-values and when you browse the data is in not a low-value??
Please paste samples of obfuscated value with hex on and within code tags for us to understand
Why do you need a reverse function |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
First of all if you want to keep the same variable and just need to replace low-values by spaces then you don’t need anything but just inspect and if you want to extract the number part and would like to move it to another field then use substring after replacing low-values to spaces. |
|
Back to top |
|
|
shymala
New User
Joined: 26 Jul 2018 Posts: 5 Location: india
|
|
|
|
Hi Rohit,
How to use substring can you give me one example of the code.
Thanks
Shymala |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Is it so hard to look in the index of the COBOL Language Refernce manual for Substring and then go the the linked page? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
You have to explain yourself better than that.- What do you mean by 'data'. Everything, including low-values, can be data !
- Is the 'data' you need a number or is it alphanumeric ?
- This means nothing: (you can look at low-values in hexa and you will see hexadecimal values as well)
Quote: |
If i do HEX ON i can see hexadecimal values in that |
What does that mean ?
Quote: |
... 123456789-12 ..... |
|
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
This should also work:
Code: |
PERFORM VARYING X FROM 1 BY 1 UNTIL MYFIELD(X:1) = LOW-VALUES OR X > 16
MOVE MYFIELD(X:1) TO NEWFIELD(X:1)
END-PERFORM |
|
|
Back to top |
|
|
shymala
New User
Joined: 26 Jul 2018 Posts: 5 Location: india
|
|
|
|
Hi all,
I have resolved my issue by using function reverse. Thanks all of you for responding to my question.But now I need 1 more info let me explain.
I need to concatenate 2 fields in my o/p file.
as of now I am getting the o/p as
{12345678} {1:1234:456}
I have a gap in b/w these 2 fields because of varying length of field1 the actual o/p should be
{12345678}{1:1234:456}
the important thing here is field 1 will be having varying length. say for example
{123}
{12345}
the 1st field length is 16 characters.
can anyone help me in solving this problem |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Please start a new topic for a new question.
When doing so please specify if that is the only space in your data (between fields) or can your actual data contain spaces?
Also show what you have tried. You actually have a possible solution, using substring (reference modification in COBOL terminology), in a previous post in this topic. |
|
Back to top |
|
|
|