i have a question about the statement DEFINE WORK FILE.
I have a solution for my problem, but I like to know, what’s the reason.
In my first Program I have a problem:
DEFINE WORK FILE 1 #DSNAME
DEFINE WORK FILE 2 #DSNAME_NEU
FIND CATALOG-VIEW WITH DSNAME = #DSNAME AND NODE = #NODE
IF NO RECORDS FOUND
WRITE 'Keine Emtex-Datei gefunden!'
ESCAPE BOTTOM
END-NOREC
READ WORK FILE 1 RECORD #EMTEXDATENSATZ
MOVE SUBSTR(#EMTEXDATENSATZ,1,50) TO #TEST
WRITE WORK FILE 2 VARIABLE #TEST
END-WORK
END-FIND
CLOSE WORK FILE 1
CLOSE WORK FILE 2
END
The problem is in the WRITE WORK FILE statment.
The systeme write: 1500 WORK-Datei 2 kann nicht geoeffnet werden , DMS ERROR: DD31.
My solution:
DEFINE WORK FILE 1 #DSNAME
DEFINE WORK FILE 2 #DSNAME_NEU
FIND CATALOG-VIEW WITH DSNAME = #DSNAME AND NODE = #NODE
IF NO RECORDS FOUND
WRITE 'Keine Emtex-Datei gefunden!'
ESCAPE BOTTOM
END-NOREC
FETCH RETURN 'ACEMTX'
END-FIND
CLOSE WORK FILE 1
CLOSE WORK FILE 2
END
and the program ‘ACEMTX’:
READ WORK FILE 1 RECORD #EMTEXDATENSATZ
MOVE SUBSTR(#EMTEXDATENSATZ,1,50) TO #TEST
WRITE WORK FILE 11 VARIABLE #EMTEXDATENSATZV
END-WORK
END
Is work file 2 (CMWKF02) defined as a variable length RECFM in the DCB? Is it a sequential (QSAM) file? Does it work if you don’t specify the VARIABLE clause?
Is work file 2 (CMWKF02) defined as a variable length RECFM in the DCB?
Yes
Is it a sequential (QSAM) file?
It is a SAM-file.
Does it work if you don’t specify the VARIABLE clause?
It is the same problem with or without the VARIABLE clause.
The problem is:
Why I can’t write in the work file 2 in the same program, but I use a second program it is OK?
It is a time-problem?
I define a work file and can’t use it in the same program. Why?
Your error seems to indicate that the program is writing to //DD31. Is this defined? Is “DD31” the content of #DSNAME_NEU? What happens if you omit the DEFINE WORK FILE 2 #DSNAME_NEU in the first program (assuming you have the default file assignments, the output should go to //CMWKF02)?
#dsname is the name of a file with a lot of data (BS2000-Accounting-data).
e.g. #dsname = sys.account.2011-03-23.e2
I need a part of this data e.g. the data with TASK. This part I will write in a new work file. (work file 2 #dsname_neu) . #dsname_neu = acc.account.2011-03-23.e2
I will write in this file - not read.
I read from work file 1 - this is all right.
If I use the FETCH RETURN statment, I can write in work file 2.
But I don’t now, why I can’t write in work file 2 in the same program
% DMS0D31 DATEINAME UNGUELTIG ODER FEHLERHAFT
% ? Der Benutzer-Dateiname folgt nicht den Konventionen.
% Moegliche Ursachen:
% 1) $USER-ID ungueltig bzw. der Benutzer hat kein Zugriffsrecht auf
% den angesprochenen Pubset;
% 2) Verlangte Funktion erlaubt keinen teilqualifizierten Dateinamen;
% Unter Meldung DMS0331 sind weitere moegliche Fehlerursachen aufgefuehrt.
% ! Das Programm verbessern und erneut versuchen.