IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want to string a series of fields


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
grabeva

New User


Joined: 07 Sep 2006
Posts: 23

PostPosted: Wed Sep 20, 2006 8:15 pm
Reply with quote

icon_rolleyes.gif icon_rolleyes.gif

i need help please......i can't do it.....

i want to string a series of fields.....but not function well...

1) at the first example, de action is: complete all field with caracter '?'
2) if i change with:
' ' DELIMITED BY ' ' complete with blank a total of field en string
3) if ia change with
' ' DELIMITED BY ' '(two blank) the same....

i want to look like this:

' OK?3601?00000?FTPE?0?01?04200?2?3'



move 1 to AUX-LENG-MSG
STRING
S-OK-3601 DELIMITED BY SIZE
'?' DELIMITED BY '?'
RE-NROMEN-3601 DELIMITED BY SIZE
'?' DELIMITED BY '?'
RE-RETORNO-3601 DELIMITED BY SIZE
'?' DELIMITED BY '?'
S-TRAN-3601 DELIMITED BY SIZE
'?' DELIMITED BY '?'
RE-HAY-MAS-3601 DELIMITED BY SIZE
'?' DELIMITED BY '?'
RE-CANT-OCCUR-3601 DELIMITED BY SIZE
'?' DELIMITED BY '?'
S-TABLA-3601(1:S-CANT-OCCUR-3601) DELIMITED
'?' DELIMITED BY '?'
RE-BOTONES-3601 DELIMITED BY SIZE
'?' DELIMITED BY '?'
INTO AREA-MENS-SALIDA
POINTER AUX-LENG-MSG

field definition:

01 AREA-MENS-SALIDA.
05 S-OK-3601 PIC X(5) VALUE SPACES.
05 S-NROMEN-3601 PIC 9(4).
05 RE-NROMEN-3601 REDEFINES S-NROMEN-3601 PIC X(4).
05 S-RETORNO-3601 PIC 9(5).
05 RE-RETORNO-3601 REDEFINES S-RETORNO-3601 PIC X(5).
05 S-TRAN-3601 PIC X(4).
05 S-HAY-MAS-3601 PIC 9.
05 RE-HAY-MAS-3601 REDEFINES S-HAY-MAS-3601 PIC X.
05 S-CANT-OCCUR-3601 PIC 9(2).
05 RE-CANT-OCCUR-3601 REDEFINES S-CANT-OCCUR-3601 PIC XX.
05 S-TABLA-3601.
07 S-LINEA-DETALLE OCCURS 25.
09 COD-OF-GRU-RICS8705 PIC 9(5).
09 RE-COD-OF-GRU-RICS8705 REDEFINES
COD-OF-GRU-RICS8705 PIC X(5).
09 filler PIC X value spaces.
09 I-ESTG2180-RICS8705 PIC 9.
09 filler PIC X value spaces.
09 IND-SUC-OL-RICS8705 PIC 9.
09 filler PIC X value spaces.
05 S-BOTONES-3601 PIC 9.
05 RE-BOTONES-3601 REDEFINES S-BOTONES-3601 PIC X .
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Sep 20, 2006 8:39 pm
Reply with quote

I think you should use:
Code:
STRING
    S-OK-3601 DELIMITED BY SPACE
    '?' DELIMITED BY SIZE
    RE-NROMEN-3601 DELIMITED BY SIZE
    '?' DELIMITED BY SIZE

and so on.
The 1st field has a size of 5 but contains in the example only 2 characters, so it should be DELIMITED BY SPACE
The literal '?' can only be DELIMITED BY SIZE, which is 1.
All other variables are numeric so they have to be DELIMITED BY SIZE as well.
Back to top
View user's profile Send private message
grabeva

New User


Joined: 07 Sep 2006
Posts: 23

PostPosted: Wed Sep 20, 2006 8:54 pm
Reply with quote

its no ok....look it...

01 AREA-MENS-SALIDA PIC X(272) ADDR 187
VALUE > OK????????????????????????0?00000?0?0?00000?0?0
+50 > ?00000?0?0?00000?0?0?00000?0?0?00000?0?0?00000?0?0
+100 > ?00000?0?0?00000?0?0?00000?0?0?00000?0?0?00000?0?0
+150 > ?00000?0?0?00000?0?0?00000?0?0?00000?0?0?00000?0?0
+200 > ?00000?0?0?00000?0?0?00000?0?0?00000?0?0?00000?0?0
+250 > ?00000?0?0?00000?0?0?0 <

complete all the first field with '?'

with this code:(look that the first field i need to see ' OK' with 3 blanks before....for that i write delimited by size.
STRING
S-OK-3601 DELIMITED BY SIZE
'?' DELIMITED BY size
lo incluye
'?' DELIMITED BY '?'
' ' DELIMITED BY ' '
RE-NROMEN-3601 DELIMITED BY SIZE
'?' DELIMITED BY size
RE-RETORNO-3601 DELIMITED BY SIZE
'?' DELIMITED BY size
S-TRAN-3601 DELIMITED BY SIZE
'?' DELIMITED BY size
RE-HAY-MAS-3601 DELIMITED BY SIZE
'?' DELIMITED BY size
RE-CANT-OCCUR-3601 DELIMITED BY SIZE
'?' DELIMITED BY size
S-TABLA-3601(1:S-CANT-OCCUR-3601) DELIMITED BY SIZE
'?' DELIMITED BY size
RE-BOTONES-3601 DELIMITED BY SIZE
'?' DELIMITED BY size
INTO AREA-MENS-SALIDA
POINTER AUX-LENG-MSG
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Sep 21, 2006 3:22 pm
Reply with quote

I'm not sure what you mean by:
Quote:
lo incluye
'?' DELIMITED BY '?'
' ' DELIMITED BY ' '

You should try piece by piece. Try first:
Code:
STRING
    S-OK-3601 DELIMITED BY SIZE
    '?' DELIMITED BY size
    RE-NROMEN-3601 DELIMITED BY SIZE
    '?' DELIMITED BY size
    INTO AREA-MENS-SALIDA
If the result is OK add more fields.
When you reach S-TABLA-3601(1:S-CANT-OCCUR-3601) DELIMITED BY SIZE be specially careful,
I'm not sure how COBOL will compute the size of this field
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts Search string in job at regular Spool... CLIST & REXX 0
Search our Forums:

Back to Top