Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

String operation with DELIMITED BY ' ' and DELIMITED BY SIZE

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

New User


Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

PostPosted: Fri Sep 02, 2011 10:35 am    Post subject: String operation with DELIMITED BY ' ' and DELIMITED BY SIZE
Reply with quote

Hi,

I have a query.....

there is a variable ws-ust1 pic X(20) value 'asdfgh'.
i defined a literal as Lit-percent pic X(1) value '%'.

My concern is I want to run a query using WS-UST1 with 'LIKE' clause.
How should i concatenate the '%' symbol prefixed and suffixed to WS-UST1.
ALSO

wuery will be something like

Select count(*)
into :ws-count
from table1 where column like ws-ust1

I tried using STRING with DELIMITED BY ' ' and DELIMITED BY SIZE but the output string only contains all '%%%%%'.

eg i tried
STRING LT-PERCENT WS-UST1 LT-PERCENT
DELIMITED BY ' ' INTO WS-UST1 .

Please help
Thanks in advance.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 02, 2011 10:42 am    Post subject:
Reply with quote

Hello,

Make the output field of the STRING be a separate field (i.e. ust2), not the ust1 field.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7255

PostPosted: Fri Sep 02, 2011 1:40 pm    Post subject: Reply to: String operation
Reply with quote

The Manual wrote:

If identifier-1 or identifier-2 occupies the same storage area as identifier-3 or identifier-4, undefined results will occur, even if the identifiers are defined by the same data description entry.


As Dick says, new ust2. You should move space first to your new ust2, each time, as the STRING does not "space fill" and you will get data left-over data from previous invocations of the string.
Back to top
View user's profile Send private message
nightbuzzz

New User


Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

PostPosted: Fri Sep 02, 2011 1:42 pm    Post subject:
Reply with quote

Thnx guys...
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Fri Sep 02, 2011 7:22 pm    Post subject:
Reply with quote

a warning:
if you have
Code:
ws-ust2 pic x(20) value '%asdfgh%            '.

you're column1 like :ws-ust2 will probably not behave as you expect. Because it will only return rows with at least 12 spaces at the end of column1.
you probably want to fill ws-ust2 with '%asdfgh%%%%%%%%%%%%%'
and the easiest way to do that is

Code:
move all '%' to ws-ust2
string ws-ust1 delimited by '  ' into ws-ust2(2:)

or
Code:
string '%' delimited by size
       ws-ust1 delimited by '  '
       '%%%%%%%%%%%%%%%%%%%%' delimited by size
into ws-ust2
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 02, 2011 7:40 pm    Post subject: Reply to: String operation
Reply with quote

Good catch icon_smile.gif

d
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 SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Joinkeys operation betwen VB and FB file Susanta SYNCSORT 4 Sun Sep 25, 2016 9:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us