Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Move a var from nth pos in a file to 1st position of another

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

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue Feb 24, 2009 5:50 pm    Post subject: Move a var from nth pos in a file to 1st position of another
Reply with quote

Code:

IF INPUT-CHAR-1 (WS-IND1) = '****'
    MOVE INPUT-CHAR-1(WS-IND1) TO INPUT-CHAR-2 (WS-IND2)



But the first file is of a variable length while the file the INPUT-CHAR-2 will be written is of FB 25, so i want the code to move INPUT-CHAR-1(WS-IND1) TO INPUT-CHAR-2(0), i.e, the first position in 2nd file. How do i do that ?

As for the existing code it throws the error

Code:

NOT ENOUGH SUBSCRIPTS OR INDICES WERE SPECIFIED FOR  INPUT-CHAR-2


what do i need to change???
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Tue Feb 24, 2009 6:02 pm    Post subject:
Reply with quote

1. subscript and index values of 0 are a no-no. the first occurance is 1.

2. what are the data descriptions of these fields?

3. we don't know if these are indexes or sub-scripts (ws-ind1, ws-ind2).

4. what is the definition of INPUT-CHAR-1 ? is it 3 char in length?
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue Feb 24, 2009 6:32 pm    Post subject: Reply to: Move a var from nth pos in a file to 1st position
Reply with quote

@dbz

sorry about that , i meant at the 1st occurence.

Currently its like this

Code:

INPUT-CHAR-1 OCCURS 25 TIMES INDEXED BY
    WS-IND1 PIC 99. 
INPUT-CHAR-2 OCCURS 25 TIMES INDEXED BY
    WS-IND2 PIC 99. 

       


and INPUT-CHAR-1 is pic X(01)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Tue Feb 24, 2009 6:45 pm    Post subject:
Reply with quote

Quote:

and INPUT-CHAR-1 is pic X(01)



no it is not,
it is PIC 99 just like INPUT-CHAR-2.
Quote:

INPUT-CHAR-1 OCCURS 25 TIMES INDEXED BY
WS-IND1 PIC 99.



and we need the level numbers of the INPUT-CHAR-1/2 data definitions so that we can determine the cause of
Quote:
NOT ENOUGH SUBSCRIPTS OR INDICES WERE SPECIFIED FOR INPUT-CHAR-2
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue Feb 24, 2009 7:07 pm    Post subject: Reply to: Move a var from nth pos in a file to 1st position
Reply with quote

Hey thanks dbz

Your last input was very helpful ....

INPUT-CHAR1 was a table array DOUBLE OCCURS CLAUSE VARIABLE (LEVEL 15), WHILE I HAD DEFINED THE INPUT-CHAR2 WITH SINGLE OCCURS CLAUSE (LEVEL 10).
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Tue Feb 24, 2009 7:11 pm    Post subject:
Reply with quote

glad you were able to determine the problem and work on a solution.
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 File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us