¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: COBOL getting system time and/or date

 

"ILE" is the Integrated Language Environment of AS/400, OS/400, iSeries, System i, IBM i platform.

It has nothing to do with LE/370 or LE/390, etc. -- and nothing to do with mainframes, other than heritage.

(The heritage is that both the mainframe and the OS/400-> IBMi platforms participated in IBM's ill-fated "SAA/CUA" project.)

They are similar, but different.


Re: COBOL getting system time and/or date

 

¿ªÔÆÌåÓý

Correct, I tried it, does not work.

36 ? ? IKF3001I-E ? ? FUNCTION NOT DEFINED. DISCARDED. ? ?

best regards,

¸é±ð²Ô¨¦.

On 3 Apr 2024, at 20:21, botongrui, aka ¦Ó¦Ò³¾. via groups.io <botongrui@...> wrote:

I don't think MVS3.8J is ILE compatible, it's far older then LE Libraries



Re: COBOL getting system time and/or date

 

I don't think MVS3.8J is ILE compatible, it's far older then LE Libraries

---
¦Ó¦Ò³¾

On Wednesday, 3 April 2024 at 19:04, Rahim Azizarab via groups.io <rahimazizarab@...> wrote:






regards;

Rahim???



??



On Wednesday, April 3, 2024 at 10:42:41 AM CDT, Alejandro olivan Alvarez <alejandro.olivan.alvarez@...> wrote:


Hi guys.

I'm missing something again regarding our beloved MVT COBOL F compiler.. this time, I'm trying to get the system date and or time, but I'm missing miserably.
I've looked for the right syntax in my collection of vintage bitsavers cobol books but I do not find anythin in the 64' and 68/ OS/360 books I have.
As always, the 72' OS VS COBOL book seems the most plausible? to me... but i barely mentions the matter on page 401 for ACCEPT.

So, I'm trying this:

ACCEPT CD-CURRENT-DATE FROM DATE.

To which the compiler complains:
?
IKF3001I-E DATE NOT DEFINED. SYSTEM UNIT ASUMED.?

So I guess I maybe missing something on the JCL, or something on the syntax is different... does anyone knows how to get data and or time?

Thanks.
Cheers.
Alejandro.


Re: COBOL getting system time and/or date

 






regards;

Rahim???



??



On Wednesday, April 3, 2024 at 10:42:41 AM CDT, Alejandro olivan Alvarez <alejandro.olivan.alvarez@...> wrote:


Hi guys.

I'm missing something again regarding our beloved MVT COBOL F compiler.. this time, I'm trying to get the system date and or time, but I'm missing miserably.
I've looked for the right syntax in my collection of vintage bitsavers cobol books but I do not find anythin in the 64' and 68/ OS/360 books I have.
As always, the 72' OS VS COBOL book seems the most plausible? to me... but i barely mentions the matter on page 401 for ACCEPT.

So, I'm trying this:

ACCEPT CD-CURRENT-DATE FROM DATE.

To which the compiler complains:
?
IKF3001I-E DATE NOT DEFINED. SYSTEM UNIT ASUMED.?

So I guess I maybe missing something on the JCL, or something on the syntax is different... does anyone knows how to get data and or time?

Thanks.
Cheers.
Alejandro.


Re: COBOL getting system time and/or date

 

It is current date not date.


regards;

Rahim???



??



On Wednesday, April 3, 2024 at 10:42:41 AM CDT, Alejandro olivan Alvarez <alejandro.olivan.alvarez@...> wrote:


Hi guys.

I'm missing something again regarding our beloved MVT COBOL F compiler.. this time, I'm trying to get the system date and or time, but I'm missing miserably.
I've looked for the right syntax in my collection of vintage bitsavers cobol books but I do not find anythin in the 64' and 68/ OS/360 books I have.
As always, the 72' OS VS COBOL book seems the most plausible? to me... but i barely mentions the matter on page 401 for ACCEPT.

So, I'm trying this:

ACCEPT CD-CURRENT-DATE FROM DATE.

To which the compiler complains:
?
IKF3001I-E DATE NOT DEFINED. SYSTEM UNIT ASUMED.?

So I guess I maybe missing something on the JCL, or something on the syntax is different... does anyone knows how to get data and or time?

Thanks.
Cheers.
Alejandro.


Re: COBOL getting system time and/or date

 

I don't believe this compiler had any means to retrieve the system date/time. You can use my date routine - y2kgetd - to retrieve the current date. I have attached a simple jobstream/program showing how to do that.

If you require the time, you will need to write an assembler subprogram to accomplish that.

Jay


Re: COBOL getting system time and/or date

 

Hi:

On my work I saw several "old" cobol programs for which there's a SYSIN card with DD DSN=SOME.FILE

Then that DSN contains current date, and COBOL performs ACCEPT FROM SYSIN.?

Maybe this was done because of there was no DATE then??


COBOL getting system time and/or date

 

Hi guys.

I'm missing something again regarding our beloved MVT COBOL F compiler.. this time, I'm trying to get the system date and or time, but I'm missing miserably.
I've looked for the right syntax in my collection of vintage bitsavers cobol books but I do not find anythin in the 64' and 68/ OS/360 books I have.
As always, the 72' OS VS COBOL book seems the most plausible? to me... but i barely mentions the matter on page 401 for ACCEPT.

So, I'm trying this:

ACCEPT CD-CURRENT-DATE FROM DATE.

To which the compiler complains:
?
IKF3001I-E DATE NOT DEFINED. SYSTEM UNIT ASUMED.?

So I guess I maybe missing something on the JCL, or something on the syntax is different... does anyone knows how to get data and or time?

Thanks.
Cheers.
Alejandro.


Re: VSAM cluster allocation error

 

Try adding UNIQUE to the cluster definition.? Also, move the space allocations to the data and index components. ? like this:

DEFINE CLUSTER??????????????????????????????????? -????????????????????????? ?
???????? (NAME(HERC02.VSAM.EXAMPLE1) INDEXED??????? -????????????????????????? ?
???????? VOLUMES(VSAM01)??????????????????????????? -????????????????????????? ?
???????? RECORDSIZE(80 80)????????????????????????? -????????????????????????? ?
???????? KEYS(10 0)???????????????????????????????? -????????????????????????? ?
???????? FREESPACE(5 5)???????????????????????????? -????????????????????????? ?
???????? CISZ(4096)???????????????????????????????? -????????????????????????? ?
???????? REUSE?? -
UNIQUE ????????????????????????????????? -????????????????????????? ?
???????? )????????????????????????????????????????? -????????????????????????? ?
???????? DATA (NAME (HERC02.VSAM.EXAMPLE1.DATA) -
???????? TRACKS(1 1))??? -????????????????????????? ?
??????? INDEX (NAME (HERC02.VSAM.EXAMPLE1.INDEX)
???????? TRACKS(50 15))

Since you don't have a VSAM dataspace, you must use the UNIQUE option.? Index components are much smaller than data components and require less space.


Re: VSAM cluster allocation error

 

Delete is fine.
MVS 3.8 uses CVOL and VSAM catalogs.
You may not have the needed catalog defined.
UNIQUE is required to get space outside a dataspace.


On Thu, Mar 21, 2024 at 3:24?PM rcigola via groups.io
<rcigola@...> wrote:

Hi guys, I am trying to allocate a VSAM file, this is the jcl :

//HERC02CP JOB (IDCAMS),'PERFORM IDCAMS ',CLASS=A,NOTIFY=&SYSUID,
// REGION=8000K,TIME=1440,MSGCLASS=X,MSGLEVEL=(1,1)
//
//* CREATE VSAM DATASET
//*
//
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD *
DELETE HERC02.VSAM.EXAMPLE1
SET MAXCC = 0
DEFINE CLUSTER -
(NAME(HERC02.VSAM.EXAMPLE1) INDEXED -
VOLUMES(VSAM01) -
RECORDSIZE(80 80) -
KEYS(10 0) -
TRACKS(50 15) -
FREESPACE(5 5) -
CISZ(4096) -
REUSE -
) -
DATA (NAME (HERC02.VSAM.EXAMPLE1.DATA)) -
INDEX (NAME (HERC02.VSAM.EXAMPLE1.INDEX))
/*

but I get this error when I try to allocate a VSAM :

IDCAMS SYSTEM SERVICES TIME: 15:45:21

DELETE HERC02.VSAM.EXAMPLE1
IDC3012I ENTRY HERC02.VSAM.EXAMPLE1 NOT FOUND
IDC3009I ** VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLAG-6
IDC0551I **ENTRY HERC02.VSAM.EXAMPLE1 NOT DELETED
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 8

SET MAXCC = 0

DEFINE CLUSTER -
(NAME(HERC02.VSAM.EXAMPLE1) INDEXED -
VOLUMES(VSAM01) -
RECORDSIZE(80 80) -
KEYS(10 0) -
TRACKS(50 15) -
FREESPACE(5 5) -
CISZ(4096) -
REUSE -
) -
DATA (NAME (HERC02.VSAM.EXAMPLE1.DATA)) -
INDEX (NAME (HERC02.VSAM.EXAMPLE1.INDEX))
IDC3033I VOLUME RECORD NOT FOUND IN CATALOG
IDC3009I ** VSAM CATALOG RETURN CODE IS 248 - REASON CODE IS IGG0CLBX-0
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12

the VSAM01 is a 3380-E disk created with :
dasdinit -a vsam01.382 3380-E VSAM01 then I initialized with this job :

//HERC02CP JOB (ICKDSF),'PERFORM ICKDSF13',CLASS=A,NOTIFY=&SYSUID,
// REGION=8000K,TIME=1440,MSGCLASS=X,MSGLEVEL=(1,1)
//*
//* INITIALIZE A DEVICE OTHER THAN 3340 OR 3350 DASD VOLUME
//*
//ICKDSF EXEC PGM=ICKDSF13,REGION=6096K
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
INIT UNITADDRESS(382) NOVERIFY VOLID(VSAM01) OWNER(HERCULES) -
VTOC(0,1,80)
/*
//

and I see the volume on 3.4 and I allocated a PD dataset without effort.
does anyone have any clue why I am getting this error ?
Thanks


--
Mike A Schwab, Springfield IL USA
Where do Forest Rangers go to get away from it all?


Re: VSAM cluster allocation error

 

No, even if you remove the delete statement you will still get an error!
Without am user catalog and data space defined on the new volume you will go nowhere

Marco


Re: VSAM cluster allocation error

 

Comment out or remove the Delete statement and rerun.? It is giving an error because the file does not exist.


regards;

Rahim



??



On Thursday, March 21, 2024 at 03:24:16 PM CDT, rcigola via groups.io <rcigola@...> wrote:


Hi guys, I am trying to allocate a VSAM file, this is the jcl :

//HERC02CP JOB (IDCAMS),'PERFORM IDCAMS? ',CLASS=A,NOTIFY=&SYSUID,???? ?
//???????????? REGION=8000K,TIME=1440,MSGCLASS=X,MSGLEVEL=(1,1)??????? ?
//
//*????????????????? CREATE VSAM DATASET?????????????????????????????? ?
//*??????????????????????????????????????????????????????????????????? ?
//
//STEP1 EXEC PGM=IDCAMS??????????????????????????????????????????????? ?
//SYSPRINT DD SYSOUT=*???????????????????????????????????????????????? ?
//SYSOUT?? DD SYSOUT=*???????????????????????????????????????????????? ?
//SYSUDUMP DD SYSOUT=*???????????????????????????????????????????????? ?
//SYSIN??? DD *??????????????????????????????????????????????????????? ?
? DELETE HERC02.VSAM.EXAMPLE1????????????????????????????????????????? ?
? SET MAXCC = 0??????????????????????????????????????????????????????? ?
? DEFINE CLUSTER??????????????????????????????????? -????????????????? ?
???????? (NAME(HERC02.VSAM.EXAMPLE1) INDEXED??????? -????????????????? ?
???????? VOLUMES(VSAM01)??????????????????????????? -????????????????? ?
???????? RECORDSIZE(80 80)????????????????????????? -????????????????? ?
???????? KEYS(10 0)???????????????????????????????? -????????????????? ?
???????? TRACKS(50 15)????????????????????????????? -????????????????? ?
???????? FREESPACE(5 5)???????????????????????????? -????????????????? ?
???????? CISZ(4096)???????????????????????????????? -????????????????? ?
???????? REUSE????????????????????????????????????? -????????????????? ?
???????? )????????????????????????????????????????? -????????????????? ?
???????? DATA (NAME (HERC02.VSAM.EXAMPLE1.DATA))??? -????????????????? ?
??????? INDEX (NAME (HERC02.VSAM.EXAMPLE1.INDEX))????????????????????? ?
/*???????????????????????????????????????????????????????????????????? ?

but I get this error when I try to allocate a VSAM :

IDCAMS? SYSTEM SERVICES?????????????????????????????????????????? TIME: 15:45:21
?????????????????????????????????????????????????????????????????????????????? ?
? DELETE HERC02.VSAM.EXAMPLE1????????????????????????????????????????????????? ?
IDC3012I ENTRY HERC02.VSAM.EXAMPLE1 NOT FOUND????????????????????????????????? ?
IDC3009I ** VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLAG-6????????? ?
IDC0551I **ENTRY HERC02.VSAM.EXAMPLE1 NOT DELETED????????????????????????????? ?
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 8????????????????????? ?
?????????????????????????????????????????????????????????????????????????????? ?
? SET MAXCC = 0??????????????????????????????????????????????????????????????? ?
?????????????????????????????????????????????????????????????????????????????? ?
? DEFINE CLUSTER??????????????????????????????????? -????????????????????????? ?
???????? (NAME(HERC02.VSAM.EXAMPLE1) INDEXED??????? -????????????????????????? ?
???????? VOLUMES(VSAM01)??????????????????????????? -????????????????????????? ?
???????? RECORDSIZE(80 80)????????????????????????? -????????????????????????? ?
???????? KEYS(10 0)???????????????????????????????? -????????????????????????? ?
???????? TRACKS(50 15)????????????????????????????? -????????????????????????? ?
???????? FREESPACE(5 5)???????????????????????????? -????????????????????????? ?
???????? CISZ(4096)???????????????????????????????? -????????????????????????? ?
???????? REUSE????????????????????????????????????? -????????????????????????? ?
???????? )????????????????????????????????????????? -????????????????????????? ?
???????? DATA (NAME (HERC02.VSAM.EXAMPLE1.DATA))??? -????????????????????????? ?
??????? INDEX (NAME (HERC02.VSAM.EXAMPLE1.INDEX))????????????????????????????? ?
IDC3033I VOLUME RECORD NOT FOUND IN CATALOG??????????????????????????????????? ?
IDC3009I ** VSAM CATALOG RETURN CODE IS 248 - REASON CODE IS IGG0CLBX-0??????? ?
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12???????????????????????????? ?
?????????????????????????????????????????????????????????????????????????????? ?
the VSAM01 is a 3380-E disk created with :
dasdinit -a vsam01.382 3380-E VSAM01 then I initialized with this job? :

//HERC02CP JOB (ICKDSF),'PERFORM ICKDSF13',CLASS=A,NOTIFY=&SYSUID,??? ?
//???????????? REGION=8000K,TIME=1440,MSGCLASS=X,MSGLEVEL=(1,1)?????? ?
//*?????????????????????????????????????????????????????????????????? ?
//*?? INITIALIZE A DEVICE OTHER THAN 3340 OR 3350 DASD VOLUME???????? ?
//*?????????????????????????????????????????????????????????????????? ?
//ICKDSF?? EXEC PGM=ICKDSF13,REGION=6096K???????????????????????????? ?
//SYSPRINT DD? SYSOUT=*?????????????????????????????????????????????? ?
//SYSIN??? DD? *????????????????????????????????????????????????????? ?
? INIT UNITADDRESS(382) NOVERIFY VOLID(VSAM01) OWNER(HERCULES) -????? ?
?????????????? VTOC(0,1,80)?????????????????????????????????????????? ?
/*??????????????????????????????????????????????????????????????????? ?
//???????????????????????????????????????????????????????????????????? ?

and I see the volume on 3.4 and I allocated a PD dataset without effort.
does anyone have any clue why I am getting this error ?
Thanks


VSAM cluster allocation error

 

Hi guys, I am trying to allocate a VSAM file, this is the jcl :

//HERC02CP JOB (IDCAMS),'PERFORM IDCAMS? ',CLASS=A,NOTIFY=&SYSUID,???? ?
//???????????? REGION=8000K,TIME=1440,MSGCLASS=X,MSGLEVEL=(1,1)??????? ?
//
//*????????????????? CREATE VSAM DATASET?????????????????????????????? ?
//*??????????????????????????????????????????????????????????????????? ?
//
//STEP1 EXEC PGM=IDCAMS??????????????????????????????????????????????? ?
//SYSPRINT DD SYSOUT=*???????????????????????????????????????????????? ?
//SYSOUT?? DD SYSOUT=*???????????????????????????????????????????????? ?
//SYSUDUMP DD SYSOUT=*???????????????????????????????????????????????? ?
//SYSIN??? DD *??????????????????????????????????????????????????????? ?
? DELETE HERC02.VSAM.EXAMPLE1????????????????????????????????????????? ?
? SET MAXCC = 0??????????????????????????????????????????????????????? ?
? DEFINE CLUSTER??????????????????????????????????? -????????????????? ?
???????? (NAME(HERC02.VSAM.EXAMPLE1) INDEXED??????? -????????????????? ?
???????? VOLUMES(VSAM01)??????????????????????????? -????????????????? ?
???????? RECORDSIZE(80 80)????????????????????????? -????????????????? ?
???????? KEYS(10 0)???????????????????????????????? -????????????????? ?
???????? TRACKS(50 15)????????????????????????????? -????????????????? ?
???????? FREESPACE(5 5)???????????????????????????? -????????????????? ?
???????? CISZ(4096)???????????????????????????????? -????????????????? ?
???????? REUSE????????????????????????????????????? -????????????????? ?
???????? )????????????????????????????????????????? -????????????????? ?
???????? DATA (NAME (HERC02.VSAM.EXAMPLE1.DATA))??? -????????????????? ?
??????? INDEX (NAME (HERC02.VSAM.EXAMPLE1.INDEX))????????????????????? ?
/*???????????????????????????????????????????????????????????????????? ?

but I get this error when I try to allocate a VSAM :

IDCAMS? SYSTEM SERVICES?????????????????????????????????????????? TIME: 15:45:21
?????????????????????????????????????????????????????????????????????????????? ?
? DELETE HERC02.VSAM.EXAMPLE1????????????????????????????????????????????????? ?
IDC3012I ENTRY HERC02.VSAM.EXAMPLE1 NOT FOUND????????????????????????????????? ?
IDC3009I ** VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLAG-6????????? ?
IDC0551I **ENTRY HERC02.VSAM.EXAMPLE1 NOT DELETED????????????????????????????? ?
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 8????????????????????? ?
?????????????????????????????????????????????????????????????????????????????? ?
? SET MAXCC = 0??????????????????????????????????????????????????????????????? ?
?????????????????????????????????????????????????????????????????????????????? ?
? DEFINE CLUSTER??????????????????????????????????? -????????????????????????? ?
???????? (NAME(HERC02.VSAM.EXAMPLE1) INDEXED??????? -????????????????????????? ?
???????? VOLUMES(VSAM01)??????????????????????????? -????????????????????????? ?
???????? RECORDSIZE(80 80)????????????????????????? -????????????????????????? ?
???????? KEYS(10 0)???????????????????????????????? -????????????????????????? ?
???????? TRACKS(50 15)????????????????????????????? -????????????????????????? ?
???????? FREESPACE(5 5)???????????????????????????? -????????????????????????? ?
???????? CISZ(4096)???????????????????????????????? -????????????????????????? ?
???????? REUSE????????????????????????????????????? -????????????????????????? ?
???????? )????????????????????????????????????????? -????????????????????????? ?
???????? DATA (NAME (HERC02.VSAM.EXAMPLE1.DATA))??? -????????????????????????? ?
??????? INDEX (NAME (HERC02.VSAM.EXAMPLE1.INDEX))????????????????????????????? ?
IDC3033I VOLUME RECORD NOT FOUND IN CATALOG??????????????????????????????????? ?
IDC3009I ** VSAM CATALOG RETURN CODE IS 248 - REASON CODE IS IGG0CLBX-0??????? ?
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12???????????????????????????? ?
?????????????????????????????????????????????????????????????????????????????? ?
the VSAM01 is a 3380-E disk created with :
dasdinit -a vsam01.382 3380-E VSAM01 then I initialized with this job? :

//HERC02CP JOB (ICKDSF),'PERFORM ICKDSF13',CLASS=A,NOTIFY=&SYSUID,??? ?
//???????????? REGION=8000K,TIME=1440,MSGCLASS=X,MSGLEVEL=(1,1)?????? ?
//*?????????????????????????????????????????????????????????????????? ?
//*?? INITIALIZE A DEVICE OTHER THAN 3340 OR 3350 DASD VOLUME???????? ?
//*?????????????????????????????????????????????????????????????????? ?
//ICKDSF?? EXEC PGM=ICKDSF13,REGION=6096K???????????????????????????? ?
//SYSPRINT DD? SYSOUT=*?????????????????????????????????????????????? ?
//SYSIN??? DD? *????????????????????????????????????????????????????? ?
? INIT UNITADDRESS(382) NOVERIFY VOLID(VSAM01) OWNER(HERCULES) -????? ?
?????????????? VTOC(0,1,80)?????????????????????????????????????????? ?
/*??????????????????????????????????????????????????????????????????? ?
//???????????????????????????????????????????????????????????????????? ?

and I see the volume on 3.4 and I allocated a PD dataset without effort.
does anyone have any clue why I am getting this error ?
Thanks


Re: COBOL help opening datasets to append records.

 

¿ªÔÆÌåÓý

Alejandro,

While not EXACTLY appropriate for your situation ¨C

I am glad to see you solved your issue and got the output you were looking for.

?

Please understand the DISPOSITION parm in JCL ¨C ?

?

NEW ¨C open an create a new file

OLD ¨C open an existing file ¨C (exclusive control)

SHR ¨C open an existing file with SHARE control

MOD ¨C open an existing file and ADD TO THE END OF THE FILE ¨C

?

?

-J-

?

Jeff Bassett

Bassettj@...

(301) 424-3362 (office)

(240) 388-7148 Cell

?

Time spent flying? - is NOT deducted from one¡¯s lifespan

?

From: [email protected] <[email protected]> On Behalf Of Alejandro olivan Alvarez via groups.io
Sent: Thursday, March 21, 2024 9:25 AM
To: [email protected]
Subject: Re: [H390-MVS] COBOL help opening datasets to append records.

?

Surprisingly, once I realized that I could simply let the destination file opened (from the execution of sort input procedure) and close it at the end of the sort output procedure, the program did what I wanted with a very nice looking set of code (early 70s style coding :-D)
It is fun to see that, as you say, cobol is simply spawning the SORT program on its own to perform the work, as the SORT program output gets printed as part of the job output.

Initially, I did the exercice with raw JCL / SORT invocation... but I required several steps, separating the headr records from the payload records into different temporary datasets, sort the payload dataset and, finally, merge them into a final one... and all that, without getting rid of duplicates (which was my initial motivation to switch to use SORT under COBOL, since MVT COBOL does not support the SUM stuff)
After reading the COBOL book from 72 about SORT (which was veeery brief, pheww, just a single example!), I learn that the in out procedures were in fact, meant, to do things similar to what I wanted to do.

The idea of tagging the header records is very clever!
The way I solved that is simply counting iterations, since I know how many records my headers consist on... however, it is an interesting ideo to handle 'variable size' headers in a future!

Regarding the software/companies you mention...well... I do not know anything about anything :-P

Cheers.
Alejandro.


Re: COBOL help opening datasets to append records.

 

Surprisingly, once I realized that I could simply let the destination file opened (from the execution of sort input procedure) and close it at the end of the sort output procedure, the program did what I wanted with a very nice looking set of code (early 70s style coding :-D)
It is fun to see that, as you say, cobol is simply spawning the SORT program on its own to perform the work, as the SORT program output gets printed as part of the job output.

Initially, I did the exercice with raw JCL / SORT invocation... but I required several steps, separating the headr records from the payload records into different temporary datasets, sort the payload dataset and, finally, merge them into a final one... and all that, without getting rid of duplicates (which was my initial motivation to switch to use SORT under COBOL, since MVT COBOL does not support the SUM stuff)
After reading the COBOL book from 72 about SORT (which was veeery brief, pheww, just a single example!), I learn that the in out procedures were in fact, meant, to do things similar to what I wanted to do.

The idea of tagging the header records is very clever!
The way I solved that is simply counting iterations, since I know how many records my headers consist on... however, it is an interesting ideo to handle 'variable size' headers in a future!

Regarding the software/companies you mention...well... I do not know anything about anything :-P

Cheers.
Alejandro.


Re: COBOL help opening datasets to append records.

 

Dear Alejandro,

If I recall correctly, COBOL programs with SORT inside are in fact a SORT main program with COBOL routines inside that do not read or write directly to the input or output files, and maybe when you open an input or output file in the COBOL input side, you are in fact reopen it.

Using COBOL with SORT is a bit tricky and difficult to maintain, specially when configuring JCL steps on advanced job schedulers. This is the reason why it is forbidden in all the big mainframes sites I have worked in Germany, France, Brasil and Spain (mainly big banks).?

In your case, the need to preserve the header records make still more difficult to solve your problem in a single program and jcl step.

Any JCL step and COBOL+SORT program is easier to replace and maintain with three JCL steps of two COBOL programs (input and output treatment), and an external SORT in an step in the middle, but we are using Hercules for fun and learning purposes, as myself currently interested in old FORTRAN IV libraries from the CBT.

Did you tried to add an additional field in the filler trailing bytes with a flag for "header record" as H01, H02,...?
You could SORT with this field as first field in the sort key specification and you wouldn't need to add special header write instructions.

Did you know EASYTRIEVE from Pansophic and later as Computer Associates??
It is very interesting how to write equivalent programs with Easytrieve.

Alejandro Garcia?
Barcelona


On dj., de mar? 21, 2024 at 11:12, Alejandro olivan Alvarez
<alejandro.olivan.alvarez@...> wrote:
Thank you all guys for the points.

The thing is that, the code I was playing with, uses SORT together with its input and output procedures (nice feature!).
The goal was to let an input dataset full of records, including a set of header records, be sorted, with duplicated records suppressed, and write them to a member, all in one go if possible.
The strategy was to use the input procedure to bypass the header redcords from sort, and write them directly to output, and in the output procedure, simply check for duplicate records
before writing to file.

So, in my sort in procedure, I opened the output file, and write the header records directly, bypassing them being fed to sort, and, politely, close the file.
Then, on the output procedure from sort, I opened again the file, checked every passing, sorted, record, and write them to output file only if they're different from the last one. And, again, close the file.
Ideally, I would have been able to open in extend mode in the sort output procedure... but there I came with the issue that that's not possible.

Playing with the SHR in the JCL, gave interesting results:
If opening in SHR mode, the second OPENing makes existeing header records to be replaced. No surprise.
But If opening in OLD mode, while the header files are kept, as expected... only a few records are written afterwards, like if the job/step ended prematurely or something weird.

What I'm doing now is to open the output file on the sort input procedure, and let it open (which doesn't look polite in my eyes), then, let the sort output procedure close it.
Since there's only a single opening, it seems I can do all the output file writes in one go in SHR mode.

Cheers.
Alejandro
?


Re: COBOL help opening datasets to append records.

 

Hi Alejandro,

Don't close the file, continue to write in
I found your logic just complicated

¸é±ð²Ô¨¦


Le jeudi 21 mars 2024 ¨¤ 11:12:56 UTC+1, Alejandro olivan Alvarez <alejandro.olivan.alvarez@...> a ¨¦crit :


Thank you all guys for the points.

The thing is that, the code I was playing with, uses SORT together with its input and output procedures (nice feature!).
The goal was to let an input dataset full of records, including a set of header records, be sorted, with duplicated records suppressed, and write them to a member, all in one go if possible.
The strategy was to use the input procedure to bypass the header redcords from sort, and write them directly to output, and in the output procedure, simply check for duplicate records
before writing to file.

So, in my sort in procedure, I opened the output file, and write the header records directly, bypassing them being fed to sort, and, politely, close the file.
Then, on the output procedure from sort, I opened again the file, checked every passing, sorted, record, and write them to output file only if they're different from the last one. And, again, close the file.
Ideally, I would have been able to open in extend mode in the sort output procedure... but there I came with the issue that that's not possible.

Playing with the SHR in the JCL, gave interesting results:
If opening in SHR mode, the second OPENing makes existeing header records to be replaced. No surprise.
But If opening in OLD mode, while the header files are kept, as expected... only a few records are written afterwards, like if the job/step ended prematurely or something weird.

What I'm doing now is to open the output file on the sort input procedure, and let it open (which doesn't look polite in my eyes), then, let the sort output procedure close it.
Since there's only a single opening, it seems I can do all the output file writes in one go in SHR mode.

Cheers.
Alejandro
?


Re: COBOL help opening datasets to append records.

 

Thank you all guys for the points.

The thing is that, the code I was playing with, uses SORT together with its input and output procedures (nice feature!).
The goal was to let an input dataset full of records, including a set of header records, be sorted, with duplicated records suppressed, and write them to a member, all in one go if possible.
The strategy was to use the input procedure to bypass the header redcords from sort, and write them directly to output, and in the output procedure, simply check for duplicate records
before writing to file.

So, in my sort in procedure, I opened the output file, and write the header records directly, bypassing them being fed to sort, and, politely, close the file.
Then, on the output procedure from sort, I opened again the file, checked every passing, sorted, record, and write them to output file only if they're different from the last one. And, again, close the file.
Ideally, I would have been able to open in extend mode in the sort output procedure... but there I came with the issue that that's not possible.

Playing with the SHR in the JCL, gave interesting results:
If opening in SHR mode, the second OPENing makes existeing header records to be replaced. No surprise.
But If opening in OLD mode, while the header files are kept, as expected... only a few records are written afterwards, like if the job/step ended prematurely or something weird.

What I'm doing now is to open the output file on the sort input procedure, and let it open (which doesn't look polite in my eyes), then, let the sort output procedure close it.
Since there's only a single opening, it seems I can do all the output file writes in one go in SHR mode.

Cheers.
Alejandro
?


Re: COBOL help opening datasets to append records.

 

¿ªÔÆÌåÓý

No - there is no EXTEND mode - too early.

Can I suggest that you use ISAM mode instead for this file if needed create a simple key if there is no field that you can use say starting with 1.

Then OPEN I-O, then all WRITE statements for a new record will work with the added benefit if also using REWRITE if you need to update an existing record.

See the documentation from Jay regarding the use of ISAM type files with Cobol for how to do it.

Vince


On 15/03/2024 13:30, Alejandro olivan Alvarez wrote:

Hi folks.

So I'm trying to append records to an existing dataset with COBOL... wich should be quite straight forward: OPEN EXTEND MY-FILE

But it seems the compiler does not support that opening mode.
I took a look at the 1972 IBM book I use as a reference for the included compiler and, at OPEN clause, section (very brief one... so maybe not a comprehensive guide with not all options covered), I see that it only mentions INPUT and OUTPUT, no EXTEND whatsoever.
So while I believe that it is indeed possible, the thing is that there must be for sure a way to perform such a fundamental operation, even with this compiler.

As anyone a clue? Am I missing something?

Thanks you.
Cheers.
Alex.??
_._,_._,_


Re: COBOL help opening datasets to append records.

 

Alex,

John has already answered your question. I have a Feingold text from that era that clearly states EXTEND is valid for OPEN, but obviously this compiler has not read the Feingold text. I have attached the output of a job showing creating and then extending a simple sequential dataset on disk.