View previous topic :: View next topic
|
Author |
Message |
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
Hi,
I have an input file having following data
Code: |
01|1|0|4|24
01|1|0|8|8
01|1|0|14|14
01|1|0|17|17
01|1|0|20|20
01|1|0|22|22
01|1|0|23|23
01|1|0|24|24
01|1|0|25|25
01|1|0|26|26
01|1|0|28|28
01|1|0|32|32
01|1|0|33|33
01|1|0|41|41
01|1|569277|24|24
|
I am facing problem while UNSTRING as the last field is not comming properly. The data are numeric which I have to move to COMP-3.
Any suggestion.
Thanks,
Nirmal |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
kedianirmal wrote: |
as the last field is not comming properly. The data are numeric which I have to move to COMP-3.
Any suggestion. |
Yes, I suggest that you explain what you mean by "not coming properly"
You really do need to learn to explain exactly what the problem is, and exactly what you have tried to resolve the issue, and of course the results from what you have tried.
Psychic day was Wednesday this week. |
|
Back to top |
|
|
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
I have defined the file as
Code: |
RECORDING MODE V
LABEL RECORDS STANDARD
RECORD CONTAINS 30 CHARACTERS
BLOCK CONTAINS 0 RECORDS. |
Code: |
UNSTRING IN-REC-1 DELIMITED BY ALL '|'
INTO F1, F2, F3, F4, F5
END-UNSTRING |
The variable are defined as:
Code: |
F1 PIC X(02)
F2 PIC X(01)
F3 PIC 9(09)
F4 PIC 9(09)
F5 PIC 9(09) |
In F5 i am getting value as 0 and not as defined in the input file. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Wrote a sample code and find the output
Code: |
UNSTR-1 01|02|04|24
DELIMITED BY ALL '|'
UN-STR1 01
UN-STR2 02
UN-STR3 000000004
UN-STR4 024 0
UNSTR-1 01|02|04|24
DELIMITED BY '|'
UN-STR1 01
UN-STR2 02
UN-STR3 000000004
UN-STR4 024 0
UNSTR-2 01|02|04|24|
DELIMITED BY '|'
UN-STR1 01
UN-STR2 02
UN-STR3 000000004
UN-STR4 000000024 |
|
|
Back to top |
|
|
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
Yes, if there is a delimiter at the end it will work fine but in the input file there is no delimeter at end of record. How to handle this. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Why not move to X(9) field and then use NUMVAL? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Have you tried
Code: |
DELIMITED BY '|' OR SIZE |
I have not tried this myself but the OR option is part of the syntax of the phrase. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Hi Robert,
SIZE is not allowed in UNSTRING |
|
Back to top |
|
|
Aji
New User
Joined: 03 Feb 2006 Posts: 53 Location: Mumbai
|
|
|
|
Hi,
DELIMITED BY '|' OR SPACE seems to be working, assuming there wont be any spaces in between the data.
Aji |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
As suggested, UNSTRING into PIC X fields rather than numeric fields . . . |
|
Back to top |
|
|
|