[HECnet] Slightly OT - How to concatenate multi line strings in DEC COBOL

Mark Wickens mark at wickensonline.co.uk
Thu Sep 13 12:18:48 PDT 2012


On 13/09/12 12:06, Sampsa Laine wrote:
All I need is a function in C that takes a string and computes it's SHA1 hash (I've got the code for this) and returns the SHA1 hash as a string, I was thinking along the lines of

int sha1hash(char *stringToHash, char *hashStringOutput);	/* returns -1 if something borks, otherwise 0 */

Anyone got a nice little bit of code for:

a) Wrapping that with the OpenVMS calling standard stuff in C (the strings will be passed in as descriptors etc, so I need to "unpack" them I suppose)

b) An example call from COBOL to that wrapper..

Anyone? :)
OK, well, my suggestion for these kinds of problems is 'DECUS archive'. If I ever get my semantic web browser up and running it will make this kind of issue trivial ;)

In the meantime I did a manual search of packages in the archive containing both 'C' and 'COB' files.
This was the list I got:

./vax89a1/cvlug/escdemo/escdemo-c.c
./vmslt01b/vu/cdwrite15_vms.c
./vmslt01b/vu/chkpw.c
./vmslt01b/vu/enable-ide.c
./vmslt01b/vu/fast_io_copy.c
./vmslt01b/vu/grant_revoke_id.c
./vmslt01b/vu/ide-info.c
./vmslt01b/vu/iishack2000-printerexploit.c
./vmslt01b/vu/rwmbx.c
./vmslt01b/vu/tcpfilter.c
./vax91b/france_1991/vaxf91a/vms/copy_folder.c
./vax91b/france_1991/vaxf91a/vms/get3.c
./vax91b/france_1991/vaxf91a/vms/latsym$setup.c
./vax91b/france_1991/vaxf91a/vms/mall.c
./vax91b/france_1991/vaxf91a/vms/show_cursor.c
./vax90b1/france/vaxf90a/vms/decw$creterm.c
./vax90b1/france/vaxf90a/vms/photo.c
./vax90b1/france/vaxf90a/vms/shar.c

These are C files contained in packages that also contain files with extension .COB
They are rooted here: http://www.decuslib.com/decus/

http://www.decuslib.com/decus/vax91b/france_1991/vaxf91a/vms/

In there are a number of COBOL files. I single out one here: find_file_with_selection.cob this calls a number of external routines for example:

* On retrouve l'adresse de l'Item Liste
	CALL "LIB$ANALYZE_SDESC" USING
		BY DESCRIPTOR ITMLST
		BY REFERENCE DUMMY1 ITMLST_ADDRESS.


	CALL "LIB$MOVC3" USING DUMMY1
		BY VALUE ITMLST_PTR
		BY REFERENCE ITMLST_MASK.

* Taille du BUFFER...
	CALL "LIB$GET_VM" USING TAILLE_BUFFER
		BY REFERENCE BUFFER_ADDRESS
		GIVING RETCODE.
	IF RETCODE IS FAILURE THEN GO TO FIN.

* Attributes BLOCK : NBR_ITEMS * 8 + 4
	MULTIPLY 8 BY NBR_ITEMS GIVING TAILLE_ATRBLK.
	ADD 4 TO TAILLE_ATRBLK.
	CALL "LIB$GET_VM" USING TAILLE_ATRBLK
		BY REFERENCE ATRBLK_ADDRESS
		GIVING RETCODE.
	IF RETCODE IS FAILURE THEN GO TO FIN.


Hopefully with a few examples of calling external routines within
the archive you should be able to figure out what you need to do.

Regards, Mark.

-- 
http://www.wickensonline.co.uk
http://declegacy.org.uk



More information about the Hecnet-list mailing list