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
 
Need to convert the 7 character field to 11 character field

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

New User


Joined: 03 May 2007
Posts: 3
Location: chennai

PostPosted: Tue Aug 07, 2007 11:39 am    Post subject: Need to convert the 7 character field to 11 character field
Reply with quote

There is a file, which has a account number field of 7 characters, need to convert the 7 character field to 11 character field by padding zeroes in the front and write to a new file using cobol program.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Aug 07, 2007 11:43 am    Post subject:
Reply with quote

kksbabu05,

Plese post the variable declarations.
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Tue Aug 07, 2007 2:18 pm    Post subject: Re: Need to convert the 7 character field to 11 character fi
Reply with quote

Does your file look something like this?
Code:

01  INFILE.                   
    02 IN-1  PIC X(10).       
    02 IN-ACC  PIC X(7).       
    02 IN-2  PIC X(33).       


and do you want it to look something like this?

Code:

01  OUTFILE.                           
    02 OUT-1 PIC X(10).                 
    02 NEW-ACC.                         
       03 FILLER PIC X(4) VALUE ZEROS. 
       03 OUT-ACC  PIC X(7).           
    02 OUT-2  PIC X(33).                             


or something else?

or do you need to pad the original 7 char field with zeros as well
e.g. is it already held as
Code:

'0000123'

or
Code:

'    123'


please give examples.
Back to top
View user's profile Send private message
kksbabu05

New User


Joined: 03 May 2007
Posts: 3
Location: chennai

PostPosted: Wed Aug 08, 2007 12:55 pm    Post subject: Re: Need to convert the 7 character field to 11 character fi
Reply with quote

IQofaGerbil wrote:
Does your file look something like this?
Code:

01  INFILE.                   
    02 IN-1  PIC X(10).       
    02 IN-ACC  PIC X(7).       
    02 IN-2  PIC X(33).       


and do you want it to look something like this?

Code:

01  OUTFILE.                           
    02 OUT-1 PIC X(10).                 
    02 NEW-ACC.                         
       03 FILLER PIC X(4) VALUE ZEROS. 
       03 OUT-ACC  PIC X(7).           
    02 OUT-2  PIC X(33).                             


or something else?

or do you need to pad the original 7 char field with zeros as well
e.g. is it already held as
Code:

'0000123'

or
Code:

'    123'


please give examples.


Hi IQofaGerbil,

Whatever file layout you have mentioned is same

The program should be a subroutine
The subroutine is called using below Linkage variables

Old Static File Layout
New Static File Layout
File Processing Indicator
EOF Indicator

If the file processing indicator = Open, the static file is opened and the control is returned back to the main program
If the File processing indicator = Read, next record in the file is read and the account number field is converted from length of 7 to 11 and the values of the record are moved to the new record layout and the data is passed back to the main program
If the EOF is reached the EOF Indicator is set to true such that the main program will stop calling the adapter to read further record
Back to top
View user's profile Send private message
kksbabu05

New User


Joined: 03 May 2007
Posts: 3
Location: chennai

PostPosted: Wed Aug 08, 2007 12:58 pm    Post subject:
Reply with quote

Hi IQofaGerbil,

Whatever file layout you have mentioned is same

The program should be a subroutine
The subroutine is called using below Linkage variables

Old Static File Layout
New Static File Layout
File Processing Indicator
EOF Indicator

If the file processing indicator = Open, the static file is opened and the control is returned back to the main program
If the File processing indicator = Read, next record in the file is read and the account number field is converted from length of 7 to 11 and the values of the record are moved to the new record layout and the data is passed back to the main program
If the EOF is reached the EOF Indicator is set to true such that the main program will stop calling the adapter to read further record


Please let me know the code
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Wed Aug 08, 2007 3:21 pm    Post subject: Re: Need to convert the 7 character field to 11 character fi
Reply with quote

Quote:

If the file processing indicator = Open, the static file is opened and the control is returned back to the main program
If the File processing indicator = Read, next record in the file is read and the account number field is converted from length of 7 to 11 and the values of the record are moved to the new record layout and the data is passed back to the main program
If the EOF is reached the EOF Indicator is set to true such that the main program will stop calling the adapter to read further record


...errrmmm I think that you have practically all but coded it yourself have you not?

Just ad a few IFs and ELSEs thow in a MOVE an OPEN maybe a READ and a GOBACK
place them all strategically in your spec and you are away!

Unless of course that this is your first Cobol program - ever?
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm

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