A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/TypeCobolTeam/TypeCobol/wiki/TypeCobolTypesNutshell below:

TypeCobolTypesNutshell · TypeCobolTeam/TypeCobol Wiki · GitHub

TypeCobol syntax (almost like Cobol 2002)

Translation into Cobol 85

01 Person TYPEDEF STRICT. 
   05 Id         pic 9(05).     
   05 lastName   pic X(30).     
   05 FirstName  pic X(30).      
   05 BirthDate  pic X(08).

Define a type Person.
Levels will be renumbered when used as a type

01 myPerson. 
   02 Id         pic 9(05).     
   02 lastName   pic X(30).     
   02 FirstName  pic X(30).      
   02 BirthDate  pic X(08).
01 myPerson    type Person.
01 myPerson2   type Person.
move myPerson  to myPerson2
*Ok because myPerson is of the same type as myPerson2
move myPerson to myPerson2
01 txtZone     pic X.
01 myPerson    type Person.
move txtZone     to myPerson    

It doesn’t compile because txtZone isn’t of the same type as myPerson.

01 txtZone     pic X.
01 myPerson    type Person.
move UNSAFE txtZone     to myPerson    

It’s allowed because the UNSAFE keyword is here to tell TypeCobol compiler to not control type.
As a developer it’s my responsibility to be sure that the content of txtZone match the description of myPerson.

01 CarInsurance.
  05 firstDriver   type Person.
  05 SecondDriver  type Person.
01 CarInsurance.
  05 firstDriver.
   06 Id         pic 9(05).     
   06 lastName   pic X(30).     
   06 FirstName  pic X(30).      
   06 BirthDate  pic X(08).
  05 SecondDriver
   06 Id         pic 9(05).     
   06 lastName   pic X(30).     
   06 FirstName  pic X(30).      
   06 BirthDate  pic X(08).

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4