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

Writing record from second column of file!!!


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

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 12:10 pm
Reply with quote

Hey

I'm writing a record of lenth 117 in a file. The below is the DD card for the output file in the JCL.

//IHSTEXCP DD DSN=XXXXXX.MASTIHST.EXCD,
// DISP=(NEW,CATLG,CATLG),
// DCB=(DSORG=PS,RECFM=FB,LRECL=117,BLKSIZE=0),
// UNIT=SMALL,SPACE=(TRK,(200,10),RLSE)

When I open the output file, the 1st column of all the records are blank. ideally it should have value. But When i tried displaying the record in the COBOL code. I'm getting proper data.

Can anyone please tell me what would have gone wrong ? why column 1 is getting blanked ?

Thanks
Angeline
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Apr 01, 2011 12:13 pm
Reply with quote

the 4th instruction in the write section has a problem.
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 12:16 pm
Reply with quote

you mean to say
// UNIT=SMALL,SPACE=(TRK,(200,10),RLSE) has some problem ?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Apr 01, 2011 12:33 pm
Reply with quote

define blank and proper data

when You say open I guess that You really mean something like ISPF browse , don' t You ?

use HEX on and tell us what You see !

using the exact terminology is essential for good communication and understanding!
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 12:41 pm
Reply with quote

The proper data is something like this.
Code:
23032972002002 XXXXX XXXX XXXX


But the output I'm getting is
Code:
 3032972002002 XXXXX XXXX XXXX


So the tow is being replaced with Blank. When I open the file is Dsu 4, and put hex on, I get the below data.

Code:
 3032972002002 3032972002        SUS  SUS-SSID
4FFFFFFFFFFFFF4FFFFFFFFFF44444444EEE44EEE6EECC
0303297200200203032972002000000002420024202294

Hope I made the pbm sound clear.

Thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Apr 01, 2011 12:51 pm
Reply with quote

what the heck is Dsu 4 ? icon_evil.gif

and how does the HEX data relate to the other two ?

and
Quote:
But When i tried displaying the record in the COBOL code.
what does it mean ?
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 12:55 pm
Reply with quote

i mean in ISPF. Sorry!!!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Apr 01, 2011 1:51 pm
Reply with quote

well we now know everything except
  • control cards?
  • example of input data records
  • example of expected output datarecords


probably time to address the issue - incorrect sort control card
instead of spending time listening to your analysis. (have you noticed the first 4 letters of analysis?)
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 2:55 pm
Reply with quote

1. No control card is used.
2. I have two input files which are processed and the output records are written in a file of fixed size using cobol code.
3. The output records is expected to look as
23032972002002 XXXXX XXXX XXXX

but what I'm getting in the file is
b3032972002002 XXXXX XXXX XXXX

where b in red is blank.
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 2:58 pm
Reply with quote

When I give display command in teh COBOL code just before the code writes the records into the file, I'm getting the expected output.

But once wriirten in the file, when I check the file, I have all banks in the 1st column of the file.

I dont understand which 4letters you are talking about ?

Thanks
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Apr 01, 2011 3:01 pm
Reply with quote

Why are you posting this in the dfsort forum if it is a cobol program? You were asked questions, and had comments mde, that were relevant for a sort question. You have not only wated your time but that of several other people.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Apr 01, 2011 3:14 pm
Reply with quote

Topic moved to COBOL forum
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Apr 01, 2011 3:39 pm
Reply with quote

ok- COBOL problem.

1. need to analyse (we need to see - please cut & paste) the
  • FD definition
  • Cobol display statement
  • write statement
  • relevent Structure definitions
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 3:57 pm
Reply with quote

Please find the details.

1. FD IHSTEXCP
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS.

01 IHSTEXCP-REC PIC X(117).

2. WRITE IHSTEXCP-REC FROM WS-IHSTEXCP-DTL
3. 01 WS-IHSTEXCP-DTL.
05 WS-EXCP-BXX PIC X(14) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.
05 WS-EXCP-WXX PIC X(10) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.
05 WS-EXCP-UXXX PIC X(05) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.
05 WS-EXCP-DESC PIC X(43) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.
05 WS-EXCP-MSG PIC X(40) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.

4. DISPLAY "B4 WRITE EXCP: "WS-IHSTEXCP-DTL
WRITE IHSTEXCP-REC FROM WS-IHSTEXCP-DTL
DISPLAY "AFTER WRITE EXCP: "WS-IHSTEXCP-DTL


Also, in the JCL, for the output file DD card, the file type is specified as FB.

//IHSTEXCP DD DSN=XXXXXX.MASTIHST.EXCD,
// DISP=(NEW,CATLG,CATLG),
// DCB=(DSORG=PS,RECFM=FB,LRECL=117,BLKSIZE=0),
// UNIT=SMALL,SPACE=(TRK,(200,10),RLSE)

But when i checked the output file created, it was of type FBA.

Thanks
Angeline
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 01, 2011 4:44 pm
Reply with quote

The first byte of an FBA file will always be the carriage control byte -- blank for single space, 0 for double space, 1 for top of form, + for overprint, and so forth. So the mystery of where your first byte is going is resolved -- it is being changed to space for carriage control.

Now the question becomes, why is the file FBA instead of FB? What does your SELECT statement look like?
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 4:58 pm
Reply with quote

that looks simple though...

SELECT IHSTEXCP ASSIGN TO UT-S-IHSTEXCP.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 01, 2011 5:07 pm
Reply with quote

How many WRITE statements for the file are in the program? Do any of them have the AFTER phrase?
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 6:14 pm
Reply with quote

The WRITE statement is used quite a few times for writing header, footer and data. But none of the WRTIE has AFTER phrase.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 01, 2011 6:35 pm
Reply with quote

Is the ADV compile option set? If so , use NOADV and try again.
Back to top
View user's profile Send private message
Jose Mateo

Active User


Joined: 29 Oct 2010
Posts: 121
Location: Puerto Rico

PostPosted: Fri Apr 01, 2011 7:16 pm
Reply with quote

Good day to all!

In your DCB the BLKSIZE should be 117 because you have one record per block and your LRECL is 117 which in this case the BLKSIZE equal LRECL.
Back to top
View user's profile Send private message
Angeline

New User


Joined: 22 Jul 2010
Posts: 10
Location: India

PostPosted: Fri Apr 01, 2011 7:24 pm
Reply with quote

Hey

No Luck... Still the file is created as FBA... icon_sad.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 01, 2011 7:36 pm
Reply with quote

Jose Mateo: actually, you're not right in stating BLKSIZE should be 117. The COBOL code has BLOCK CONTAINS 0 RECORDS, which indicates that the block size will be set by the JCL and COBOL will use the system block size. The JCL has BLKSIZE=0, which is used by the system to indicate that the maximum block size for the device should be used. For disk, the block size will be as close to 27998 (half-track) as possible while for tape the block size will be as close to 32760 as possible. Block size will be 27963 for a disk file, which is implied by the UNIT and SPACE parameters of the JCL.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 01, 2011 7:54 pm
Reply with quote

Angeline: something is causing the COBOL program to use the first byte of the record as carriage control. It is not obvious from your posts what that something is. Your best workaround, in the absence of a solution, is to add a filler byte to the beginning of the record and change the file to 118 bytes instead of 117. The original 117 bytes are preserved in bytes 2 through 118 of the output record -- you'll have to make the code change(s) to support this. You can add a step to your job after the program execution to use IEBGENER to copy the 118-byte-record file to a 117-byte-record file.
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Fri Apr 01, 2011 8:08 pm
Reply with quote

I have nothing to add in the way of a solution, all of you have given your input.
BUT, I have seen too many times where the REQUESTER gives incomplete information and you folks have to keep asking for more information.

For this one - the request came in --- Fri Apr 01, 2011 12:10 pm and you folks started answers within 3 minutes. With back and forth conversations, it took 4 hours for the requester to give you enough data to solve the problem.

You folks are very patient. Congratulations
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Sat Apr 02, 2011 7:47 pm
Reply with quote

Angeline wrote:
The WRITE statement is used quite a few times for writing header, footer and data. But none of the WRTIE has AFTER phrase.

What do you mean by that? Is your program writing report lines to another output DD?

If so, check if you by mistake have referenced your data output in any of the statements belonging to report output.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top