Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6967
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: 6967
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: 6967
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us