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
 
About comp-4, comp-5, comp-6

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

New User


Joined: 29 Oct 2003
Posts: 1

PostPosted: Wed Oct 29, 2003 7:51 pm    Post subject: About comp-4, comp-5, comp-6
Reply with quote

hi,

if any one know are heard about comp-4,comp-5,comp-6 please post the reply this was asked in my interview.

and if any one heard about 76 and 78 level number give the information


with regards,

harini navathi
Back to top
View user's profile Send private message

mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 238
Location: USA

PostPosted: Wed Oct 29, 2003 10:42 pm    Post subject:
Reply with quote

The format of a COMP-4 item is two's-complement binary. COMP-4 values are stored in a machine-independent format. This format places the highest-order part of the value in the leftmost position and follows down to the low-order part in the rightmost position. The number of bytes a data item occupies depends on the number of "9"s in its PICTURE and on the presence of various compile-time options. This is summarized in the following table:


Code:
# of "9"s    Default    -D1    -Dm
  1-2            2           1       1
  3-4            2           2       2
  5-6            4           4       3
  7-9            4           4       4
 10-11           8           8       5
 12-14           8           8       6
 15-16           8           8       7
 17-18           8           8       8

The format of a COMP-5 data item is identical to a COMP-4 data item, except that the data is stored in a machine-dependent format. It is stored in an order that is natural to the host machine. For example, a PIC S9(4) COMP-5 data item is equivalent to a 16-bit binary word on the host machine, and a PIC S9(9) COMP-5 item is equivalent to a 32-bit word. Note that data stored in a COMP-5 field may not be transportable to other machines because different machines have different natural byte-orderings. On many machines (68000, most RISC), COMP-5 is identical to COMP-4. On others (80x86, VAX), it is the same with the bytes in the reverse order.

COMP-5 is primarily used to communicate with external programs that expect native data storage. A VALUE clause for a COMP-5 data item is stored in a machine-independent format and is adjusted when it is loaded into the data item. This ensures that the value is the same from machine to machine.

Level 01 and level 77 data items that are COMP-5 are automatically synchronized to an appropriate machine boundary, regardless of any compile-time settings. This allows you to pass these items safely to C subroutines without having to concern yourself with alignment.

The format of a COMP-6 item is identical to a COMP-3 item except that it is unsigned and no space is allocated for the sign. Thus there are two decimal digits per byte, and the actual size of the item is determined by dividing its PICTURE size by two and rounding up.


About Level 76 & 78, will get back to you on this.

Hope this helps

Regards

Mayuresh Tendulkar
Back to top
View user's profile Send private message
Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Sat Nov 28, 2009 5:17 pm    Post subject: Reply to: about comp-4,comp-5,comp-6
Reply with quote

Hi,

I dont think there are any 76 and 78 levels in cobol.

I have only heard about 66, 77 and 88 levels.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10364
Location: italy

PostPosted: Sat Nov 28, 2009 6:32 pm    Post subject: Reply to: about comp-4,comp-5,comp-6
Reply with quote

looks like a guinness record icon_biggrin.gif
a reply to a post inactive for...

Code:

years 1           6 ( months difference / 12 )
years 2           6 ( years difference )
months           73
days           2221
hours         53322
minutes     3199355
seconds   191961300


here is the silly code
Code:

#!/opt/ooRexx/bin/rexx

numeric digits 64

daten = "20091128-12:47:00"
dateo = "20031029-18:12:00"

diff = d2s(daten) - d2s(dateo)

say "years 1 " right(( ( substr(daten,1,4)*12 + substr(daten,5,2) ) - ,
                 ( substr(dateo,1,4)*12 + substr(dateo,5,2) ) ) % 12,10) ,
                 "( months difference / 12 )"
say "years 2 " right(substr(daten,1,4) - substr(dateo,1,4),10) ,
                "( years difference )"
say "months  " right(( substr(daten,1,4)*12 + substr(daten,5,2) ) - ,
               ( substr(dateo,1,4)*12 + substr(dateo,5,2) ),10)
say "days    " right(diff % ( 60 * 60 * 24 ),10)
say "hours   " right(diff % ( 60 * 60 ),10)   
say "minutes " right(diff % ( 60 ),10)
say "seconds " right(diff,10)
exit

d2s:procedure
   parse arg dt
   parse var dt d "-" h ":" m ":" s
    return date("b",d,"s")*(24*60*60) + h * 60 * 60 + m * 60 + s
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 CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm

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