Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
extracting data from input parm excluding spaces

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
jcbrowser

New User


Joined: 06 Oct 2005
Posts: 12

PostPosted: Tue Jan 30, 2007 8:34 pm    Post subject: extracting data from input parm excluding spaces
Reply with quote

In my program I am receiving a parm string of 10 characters.

I need to extract everything but the spaces and place that data into a field whos length is equal to the number of characters extracted.

Is there an easy way to do this?

Examples; (@ is a space)

'@@@@ABCD@@' result 'ABCD' length 4 no trailing or leading spaces
'@@@@AB@@@@' result 'AB' length 2 no trailing or leading spaces
'@@A@@@@@@@' result 'A' length 1 no trailing or leading spaces
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jan 30, 2007 9:11 pm    Post subject:
Reply with quote

This should come close..... icon_biggrin.gif
Code:
working storage:
01 save.
   05 save-size pic s9(4) comp.
   05 save-area pic x occurs 100 times
                      depending on save-size.
linkage:
01 parm.
   05 parm-size pic s9(4) comp.
   05 parm-area pic x occurs 100 times
                      depending on parm-size.
procedure:
Perform varying x from 1 by 1 until x > parm-size
   if parm-area(x:1) = space
      continue
   else
      unstring parm-area(x:function length(parm-area + 1) - x)
         into save-area delimited by spaces
            count in save-length
      end-unstring
   end-fi
end-perform
Back to top
View user's profile Send private message
jcbrowser

New User


Joined: 06 Oct 2005
Posts: 12

PostPosted: Tue Jan 30, 2007 9:26 pm    Post subject:
Reply with quote

Thanks William, I will give that a try icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Where is output from PARM ABEXIT (SNA... packerm CA Products 3 Thu Sep 28, 2017 4:06 pm
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us