IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

I need to remove low values in my field


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
shymala

New User


Joined: 26 Jul 2018
Posts: 5
Location: india

PostPosted: Sun Jul 29, 2018 11:15 am
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Sun Jul 29, 2018 2:12 pm
Reply with quote

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 icon_confused.gif icon_confused.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Sun Jul 29, 2018 6:49 pm
Reply with quote

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
View user's profile Send private message
shymala

New User


Joined: 26 Jul 2018
Posts: 5
Location: india

PostPosted: Sun Jul 29, 2018 10:10 pm
Reply with quote

Hi Rohit,

How to use substring can you give me one example of the code.

Thanks
Shymala
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Jul 30, 2018 4:37 am
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Jul 30, 2018 7:25 pm
Reply with quote

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
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Jul 31, 2018 1:33 am
Reply with quote

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
View user's profile Send private message
shymala

New User


Joined: 26 Jul 2018
Posts: 5
Location: india

PostPosted: Wed Aug 01, 2018 6:16 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Aug 01, 2018 7:23 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Remove leading zeroes SYNCSORT 4
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top