View previous topic :: View next topic
|
Author |
Message |
radha reddy
New User
Joined: 15 May 2008 Posts: 9 Location: hyderabad
|
|
|
|
7003-51211 YN NYLKOORB
I want to read the above string until we get a numeric value and then will take 10 bytes, which will result in 7003-51211 and after next space we will take YN and after that we will take until we hit two consecutive spaces ie we will get NYLKOORB.
Please let me know how can i perform the same.
Do i need to use string or inspect?
And also let me know the syntax. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello radha reddy and welceom to the fourms,
Are the values in the record always like the example you've shown? If not please post examples of the different ways the data might be stored.
If the values are always in that fixed format, simple moves may do what you need. |
|
Back to top |
|
|
radha reddy
New User
Joined: 15 May 2008 Posts: 9 Location: hyderabad
|
|
|
|
Hi scherrer,
Thanks u for the reply.
Format will be almost same or it can be like 7003-51211 YN SLLIH YLREVEB.
i want the solution the way i have mentioned above to make sure that it handles all the formats. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Morning radha reddy !
I think, by using the commands Inspect and String/Unstring with Pointer, you could build a little loop over the input-sentence and extract your strings. |
|
Back to top |
|
|
radha reddy
New User
Joined: 15 May 2008 Posts: 9 Location: hyderabad
|
|
|
|
Can i know the exact syntax for using inspect and string to get the required solution. |
|
Back to top |
|
|
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
HI,
Read the String as ARRAY by character way and use ISNUMERIC option and get the numeric value repeat the loop 10 times and get the string into temparary varilable and use it
This is without using STRING and INSPECT function. |
|
Back to top |
|
|
HappySrinu
Active User
Joined: 22 Jan 2008 Posts: 194 Location: India
|
|
|
|
if you got the Quick reference, pls check the exact syntax on QW INSPECT & QW string on any command prompt line in ISPF.
if you don't have ..
>>--INSPECT--identifier-1--TALLYING-----------------------------------------
>----identifier-2--FOR------CHARACTERS--------------------------------------
| +-| phrase 1 +-+
+---ALL------------identifier-3-------------------
+-LEADING-+ +-literal-1----+ +-| phrase 1
phrase 1:
+----BEFORE-------------------identifier-4----------------------------------
+-AFTER--+ +-INITIAL-+ +-literal-2----+
For String:
>>--STRING----------------------------------------------------------->
>--------identifier-1------DELIMITED------------identifier-2--------->
+-literal-1----+ +-BY-+ +-literal-2----|
+-SIZE---------+
>--INTO--identifier-3------------------------------------------------>
+-----------POINTER--identifier-4-+
+-WITH-+
+---------OVERFLOW--imperative-statement-1-+
+-ON-+ |
|
Back to top |
|
|
radha reddy
New User
Joined: 15 May 2008 Posts: 9 Location: hyderabad
|
|
|
|
Hi Srinu,
Thank you for the syntax.
I have the general syntax, but i was asking for the actual syntax for my problem.
Anyhow i am trying with FUNCTION NUMVAL, i will let you know once i finish. |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Radha ,
First use INSPECT as follows
Code: |
.
INSPECT WS-VAR REPLACING ALL SPACES BY '#'
UNSTRING WS-VAR DELIMITED BY '#' INTO WS-VAR-1,WS-VAR-2 ....
|
here im using only spaces as the delimiter for unstring ...
you must be aware of how many parts your variable can be broken into ... now if your string is " 7003 51211 YN NYLKOORB " how do you want the o/p to be ??? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
IMHO, try using an in-line PERFORM with reference-modification checks against each byte of the target string.
Because you'd be checking individual bytes, instead of using NUMERIC (which internally generates a TRT), you can check for NOT < ZERO and NOT > '9', which internally will generate two CLI's, which are a much cheaper set of instructions than a single "Translate and Test".
INSPECT TALLYING calls a COBOL run-time routine, whereas, the in-line PERFORM stays within the program.
Just my .02 cents....
Bill |
|
Back to top |
|
|
radha reddy
New User
Joined: 15 May 2008 Posts: 9 Location: hyderabad
|
|
|
|
Thanks a lot.
I Discussed with my supervisor and conviced him that we go with simple move using reference modification. |
|
Back to top |
|
|
|