|
View previous topic :: View next topic
|
| Author |
Message |
migusd
New User
Joined: 08 Aug 2014 Posts: 44 Location: USA
|
|
|
|
hello,
I am having trouble with parse and unable to find what is wrong.
I have several records starting with '#', variable length and ending with blanks.
so I thought parsing the lines would work fine.
Except that I am not able to see what is the issue in the following:
| Code: |
INREC PARSE=(%1=(STARTAFT=BLANKS,FIXLEN=4),
%2=(STARTAT,C=#',ENDBEFR=C' '),
*
%3=(ENDBEFR=C' '')),
BUILD=(%1,C' ',%2,C' ',%3)
|
Its rejecting the %2.
so what am I missing here? |
|
| Back to top |
|
 |
migusd
New User
Joined: 08 Aug 2014 Posts: 44 Location: USA
|
|
|
|
sorry... this is the correct code/message
| Code: |
SYSIN :
INREC PARSE=(%1=(STARTAFT=BLANKS,FIXLEN=4), +
%2=(STARTAT=C'#',ENDBEFR=BLANKS), +
*
%3=(ENDBEFR=C' ')), +
BUILD=(%1,C' ',%2,C' ',%3,C' ')
|
[/code] |
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1216 Location: Dublin, Ireland
|
|
|
|
I think you should use %01 & %02 as indicated in the manual, not %1 & %2.
Garry. |
|
| Back to top |
|
 |
migusd
New User
Joined: 08 Aug 2014 Posts: 44 Location: USA
|
|
|
|
thank you Garry
but it didn't make a difference .
Still getting the same error
| Code: |
SYSIN :
INREC PARSE=(%01=(STARTAFT=BLANKS,FIXLEN=4), +
%02=(STARTAT=C'#',ENDBEFR=C' '), +
*
%03=(FIXLEN=5)), +
BUILD=(%01,C' ',%02,C' ',%03,C' ')
SORT FIELDS=(01,40,CH,A)
WER813I INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED
WER268A INREC STATEMENT : SYNTAX ERROR |
The following is a sample of the data in the input file:
LN3T.X33.BRTFILE L01P #BR85.ISX.CRB.wcrx.** 1043, 1301,
LN3T.X33.BRTFILE L01P #BR85.ISX.CRB.ctsx.** 1584 50
What I would like to get out of this sort is L01P as %01, #BR85.*.** as %02, and 1043, as %03.
The trouble is none of them start in the same position. %02 is variable length, and %03 could contain a comma. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
Any syntax %1, and %01 is allowed.
The problem with %2 is, missing mandatory parameter FIXLEN=
| Code: |
SYSIN :
INREC PARSE=(%01=(STARTAFT=BLANKS,FIXLEN=4), +
%02=(STARTAT=C'#',ENDBEFR=C' '), +
*
%03=(FIXLEN=5)), +
BUILD=(%01,C' ',%02,C' ',%03,C' ')
SORT FIELDS=(01,40,CH,A)
WER813I INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED
WER268A INREC STATEMENT : SYNTAX ERROR |
|
|
| Back to top |
|
 |
migusd
New User
Joined: 08 Aug 2014 Posts: 44 Location: USA
|
|
|
|
Indeed. that made the difference.
so, FIXLEN is for the output field?
in that case I got it wrong.
Thanks Sergeyken |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
Sample:
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
PARSE=(%01=(STARTAFT=BLANKS,ENDBEFR=BLANKS,FIXLEN=4),
%02=(STARTAT=NONBLANK,ENDBEFR=BLANKS,FIXLEN=44),
%03=(STARTAT=NUM,ENDBEFR=C',',ENDBEFR=BLANKS,FIXLEN=8)),
BUILD=(%01,C'|',%02,C'|',%03,C'|'))
END |
Output:
| Code: |
****** **************************** Datenanfang ********************
000001 L01P|#BR85.ISX.CRB.wcrx.** |1043 |
000002 L01P|#BR85.ISX.CRB.ctsx.** |1584 |
****** **************************** Datenende ********************** |
|
|
| Back to top |
|
 |
migusd
New User
Joined: 08 Aug 2014 Posts: 44 Location: USA
|
|
|
|
| thanks Joerg |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
| Code: |
. . . . .
BUILD=(%01,C'|',%02,C'|',%03,JFY=(SHIFT=RIGHT),C'|'))
. . . . |
This is to align the numerics properly. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| sergeyken wrote: |
| Code: |
. . . . .
BUILD=(%01,C'|',%02,C'|',%03,JFY=(SHIFT=RIGHT),C'|'))
. . . . |
This is to align the numerics properly. |
Just wanted to demonstrate how it could be coded.
To align properly, I would go with SFF or UFF.
| Code: |
| BUILD=(%01,C'|',%02,C'|',%03,UFF,C'|')) |
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
UFF operates with numeric values only, while JFY works with any data.
If, by a chance, the parsed value is not fully numeric (such as ‘256MB’), then the result of conversion to UFF may be surprising…  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|