jrw@bpdsun1.uucp (Jon Wahlmann) (08/11/89)
I have come across the ENCODE and DECODE key words in a few of the programs that I have been working with. I now realize that they are Fortran66 key words. My question is what are the Fortran77 equivalents of these two key words. Microsoft FORTRAN says that the equivalents are just READ and WRITE. I need to know the exact syntax in going from ENCODE and DECODE to READ and WRITE. An example of a command line that I have come across is: ENCODE(7,43,DUMMY1)DUMMY2 How would I form the equivalent with READ? Thanks for any help. Jon Wahlmann Harris Broadcast, Quincy, IL. Phone: (217) 222-8200, x3619
chidsey@smoke.BRL.MIL (Irving Chidsey ) (08/11/89)
In article <1989Aug10.220842.18863@bpdsun1.uucp> jrw@bpdsun1.UUCP (Jon Wahlmann) writes:
<
<I have come across the ENCODE and DECODE key words in a few of the programs
<that I have been working with. I now realize that they are Fortran66 key
<words. My question is what are the Fortran77 equivalents of these two
<key words. Microsoft FORTRAN says that the equivalents are just READ and
<WRITE. I need to know the exact syntax in going from ENCODE and DECODE to
<READ and WRITE. An example of a command line that I have come across is:
<
< ENCODE(7,43,DUMMY1)DUMMY2
<
<How would I form the equivalent with READ?
<
You can't, ENCODE is similar to a write.
summarizing my old CDC Frotran manual:
Write 7 characters using Format 43 into internal file DUMMY1. The characters
are in variable (or array) DUMMY2.
It was used to construct field definitions in format specifications during
execution.
DECODE was similar to a read and could be used to pack partial contents of
two words into one.
Note, you have to be careful about word length. CYBER words were 10 characters
long, most others were shorter.
<Thanks for any help.
<
<Jon Wahlmann
<
<Harris Broadcast, Quincy, IL.
<Phone: (217) 222-8200, x3619
Hope this helps.
Irv
--
I do not have signature authority. I am not authorized to sign anything.
I am not authorized to commit the BRL, the DOA, the DOD, or the US Government
to anything, not even by implication.
Irving L. Chidsey <chidsey@brl.mil>
forags@violet.berkeley.edu (08/11/89)
ENCODE is like a Fortran-77 "internal write" (formatted write to memory) statement. Its syntax was: ENCODE (nchr, fmt, address) iolist where nchr is the number of characters to write, fmt a Fortran format number, and address is the name of the variable in which you want to store the result. For example, suppose you had integer variables for day, month, year and wanted to form a character string date like dd/mm/yy. (this is a slight mixture of Fortran-66 and 77): INTEGER DAY, MONTH, YEAR CHARACTER*8 DATE C C USING ENCODE ENCODE (8,10,DATE) DAY, MONTH, YEAR 10 FORMAT (I2,'/',I2,'/',I2) C C USING FORTRAN-77 INTERNAL WRITE WRITE (DATE,10) DAY, MONTH, YEAR DECODE is the reverse of ENCODE, that is, a formatted read from memory. To continue with the example, to read DAY, MONTH, and YEAR out of DATE: C C USING DECODE DECODE (8,20,DATE) DAY, MONTH, YEAR 20 FORMAT (I2,1X,I2,1X,I2) C C USING FORTRAN-77 INTERNAL READ READ (DATE,20) DAY, MONTH, YEAR Al Stangenberger Dept. of Forestry & Resource Mgt. forags@violet.berkeley.edu 145 Mulford Hall - Univ. of Calif. uucp: ucbvax!ucbviolet!forags Berkeley, CA 94720 BITNET: FORAGS AT UCBVIOLE (415) 642-4424
jbush@ficc.uu.net (james bush) (08/11/89)
In article <1989Aug10.220842.18863@bpdsun1.uucp>, jrw@bpdsun1.uucp (Jon Wahlmann) writes: > > I have come across the ENCODE and DECODE key words in a few of the programs > ... > ENCODE(7,43,DUMMY1)DUMMY2 > > How would I form the equivalent with READ? I think (though I am not positive about the format of the encode) that it would be READ(DUMMY1, 43)DUMMY2 The 7, I believe, is the size of DUMMY1. It is not needed any more in the read. -- James Bush,Ferranti,Houston Know the truth, not what everyone else believes "... the Lord that formed me *from the womb* to be His servant ..." Isa 49:5 Internal: jbush,5230, mail A/3204, room A/3602 External: ..!uunet!ficc!jbush All opinions are my own, and do not represent those of my employer.
jbush@ficc.uu.net (james bush) (08/12/89)
In article <10705@smoke.BRL.MIL>, chidsey@smoke.BRL.MIL (Irving Chidsey ) writes: > In article <1989Aug10.220842.18863@bpdsun1.uucp> jrw@bpdsun1.UUCP (Jon Wahlmann) writes: > < > <I have come across the ENCODE and DECODE key words in a few of the programs > < > You can't, ENCODE is similar to a write. I had posted in response to this before. Mr. Chidsey is correct; I just wasn't thinking. Substitute WRITE for READ in my posting. -- James Bush,Ferranti,Houston Know the truth, not what everyone else believes "... the Lord that formed me *from the womb* to be His servant ..." Isa 49:5 Internal: jbush,5230, mail A/3204, room A/3602 External: ..!uunet!ficc!jbush All opinions are my own, and do not represent those of my employer.
hybl@mbph.UUCP (Albert Hybl Dept of Biophysics SM) (08/15/89)
In message <1989Aug11.162714.25029@agate.berkeley.edu> from forags@violet.berkeley.edu, Al Stangenberger writes: >ENCODE is like a Fortran-77 "internal write" (formatted write >to memory) statement. Its syntax was: ^^^ > > ENCODE (nchr, fmt, address) iolist > >where nchr is the number of characters to write, fmt a Fortran >format number, and address is the name of the variable in which >you want to store the result. Unfortunately, the verb "was" is still "is." ENCODE and DECODE are, as Al implies, antiquated statements that were useful in their time but are now barnacles that impede portability. Rather than scraping them from the language, many implementations offer them as "extensions." The neologism has reversed the meaning of the word! BTW, the ENCODE/DECODE statements were also implemented with syntax: ^^^^ ENCODE (fmt, nchr, address) iolist ---------------------------------------------------------------------- Albert Hybl, PhD. Office UUCP: uunet!mimsy!mbph!hybl Department of Biophysics Home UUCP: uunet!mimsy!mbph!hybl!ah University of Maryland CoSy: ahybl School of Medicine Baltimore, MD 21201 Phone: (301) 328-7940 (Office) ----------------------------------------------------------------------