![Smile :)](https://www.ibmmainframeforum.com/images/smilies/icon_e_smile.gif)
I'm currently working on a programm wich :
1- read every line of a FB file (I'm not supposed to know it's length)
2- translate each line
3- Then copy it to an output FB file (lenght = input's lenght + 2)
==============
First, I open my input file, I get it's LRECL then I open my output file in move mode with TYPE=J , so I don't need to know the LRECl at this point.
Then comes my main issue :
As I read my input file using a GET macro in move mode, I have to declare an AREA with the same length using a DC clause.
How can I do such thing without knowing the actual length ?
Do I have to use a Macro to declare my AREA ?
Can EX instruction do such thing ?
Here's my current code.
*---------------------------------------------------------------------- 00010056
* TRANSCODAGE - TR - EBCDIC 1147 ==> ASCII 00020056
*---------------------------------------------------------------------- 00040056
ASMSRCXF CSECT 00050056
INITL 10,EQU=R
*---------------------------------------------------------------------- 00070056
* MAIN 00080056
*---------------------------------------------------------------------- 00090056
BAL R6,OPEN_FIC OPEN 00100056
BAL R6,MAIN_TRT READ AND TRANSLATE 00110056
BAL R6,CLOSEFIC CLOSE 00120056
BAL R6,FIN_PGM EXIT 00130056
*---------------------------------------------------------------------- 00140056
* OPEN_FIC : 00150056
*---------------------------------------------------------------------- 00160056
OPEN_FIC EQU * 00170056
OPEN (APIFILE,(OUTPUT)) OPEN DEBUG FILE 00171099
OPEN (INPUT,(INPUT)) OPEN INPUT FILE 00180099
USING IHADCB,INPUT 00180199
LH R5,DCBLRECL R5 = LRECL 00180299
STH R5,LENGTH 00180399
AHI R5,2 R5 = LRECL + 2 00180599
STH R5,LENGTH_MOD 00180699
RDJFCB ASCII 00180899
MVC JFCLRECL,LENGTH_MOD 00180999
PUT APIFILE,JFCLRECL 00181099
OPEN (ASCII,(OUTPUT)),TYPE=J OPEN WITH MOD. JFCB 00182099
BR R6 00280099
* 00290056
*---------------------------------------------------------------------- 00300056
* MAIN_TRT : READ AND TRANSLATE 00310056
*---------------------------------------------------------------------- 00320056
MAIN_TRT EQU * 00330056
READFIC GET INPUT,DATAIN 00340068
TR DATAIN,EBTOAS EBDCI ==> ASCII 00350056
MVC2 MYOUT,DATAIN 00360077
MVC MYOUT+255(2),CRLF HERE WE ADD CR-LF 00370099
PUT ASCII,MYOUT 00380056
B READFIC 00390056
ENDFIC EQU * 00400056
CLOSE ASCII 00410056
FREEPOOL ASCII 00420056
BR R6 00430056
* 00440056
*---------------------------------------------------------------------- 00450056
* CLOSEFIC 00460056
*---------------------------------------------------------------------- 00470056
CLOSEFIC EQU * 00480056
CLOSE INPUT 00490068
CLOSE APIFILE 00500092
CLOSE ASCII 00510086
BR R6 00520056
* 00530056
*---------------------------------------------------------------------- 00540056
* FIN_PGM : EXIT 00550056
*---------------------------------------------------------------------- 00560056
FIN_PGM EQU * 00570056
RCNTL RC=0 00580056
* 00590056
*---------------------------------------------------------------------- 00600056
* WORKING STORAGE 00610056
*---------------------------------------------------------------------- 00620056
* 00639299
DS 0D 00639399
EXLIST DC X'87' 00639499
DC AL3(JFCB1) 00639599
JFCB1 DS 0CL176 DSECT JFCB 00639699
JFDSN DS CL44 DATA SET NAME 00639799
ORG JFCB1 00639899
PRINT OFF 00639999
IEFJFCBN 00640099
PRINT ON 00640199
ORG 00640299
* 00640399
MYOUT DS CL255 00641099
DATAIN DS CL255 00650099
LENGTH DS H 00651099
LENGTH_MOD DS H 00652099
* 00660056
*- EBCDCI 1147 ==> ASCII 00680056
*- 0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F- 00690056
EBTOAS DC 0CL256 00700056
DC X'000102039C09867F978D8E0B0C0D0E0F' 00_0F 00710064
DC X'101112139D8508871819928F1C1D1E1F' 10_1F 00720064
DC X'80818283840A171B88898A8B8C050607' 20_2F 00730064
DC X'909116939495960498999A9B14159E1A' 30_3F 00740064
DC X'20A0E2E440E1E3E55CF1BA2E3C282B21' 40_4F 00750064
DC X'267BEAEB7DEDEEEFECDFA7242A293B5E' 50_5F 00760064
DC X'2D2FC2C4C0C1C3C5C7D1F92C255F3E3F' 60_6F 00770064
DC X'F8C9CACBC8CDCECFCCB53AA3E0273D22' 70_7F 00780064
DC X'D8616263646566676869ABBBF0FDFEB1' 80_8F 00790064
DC X'5B6A6B6C6D6E6F707172AABAE6B8C680' 90_9F 00800064
DC X'6022737475767778797AA1BFD0DDDEAE' A0_AF 00810064
DC X'A223A5B7A95DB6BCBDBEAC7CAF7E92D7' B0_BF 00820067
DC X'E94142434445464748492DF4F6F2F3F5' C0_CF 00830064
DC X'E84A4B4C4D4E4F505152B9FBFCA6FAFF' D0_DF 00840064
DC X'E7F7535455565758595AB2D4D6D2D3D5' E0_EF 00850064
DC X'30313233343536373839B3DBDCD9DA20' F0_FF 00860064
* 00870056
*- ASCII ==> EBCDIC 1147 00890056
*- 0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F- 00900056
ASTOEB DC 0CL256 00910056
DC X'00010203372D2E2F1605250B0C0D0E9F' 00_0F 00920065
DC X'101112131415161718191A1B1C1D1E1F' 10_1F 00930065
DC X'404F7FB15B6C507D4D5D5C4E6B604B61' 20_2F 00940063
DC X'F0F1F2F3F4F5F6F7F8F97A5E4C7E6E6F' 30_3F 00950063
DC X'44C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6' 40_4F 00960063
DC X'D7D8D9E2E3E4E5E6E7E8E99048B55F6D' 50_5F 00970063
DC X'A0818283848586878889919293949596' 60_6F 00980063
DC X'979899A2A3A4A5A6A7A8A951BB54BD40' 70_7F 00990065
DC X'9F404040404040404040404C40404040' 80_8F 01000065
DC X'407DBE7FA14B6060BD40A26E40404040' 90_9F 01010067
DC X'40AAB07BB1B2DD5A40B49A8ABACAAFBC' A0_AF 01020065
DC X'4A8FEAFABE79B6B39DDA9B8BB7B8B9AB' B0_BF 01030066
DC X'6465626663679E687471727378757677' C0_CF 01040065
DC X'AC69EDEEEBEFECBF80FDFEFBFCADAE59' D0_DF 01050065
DC X'7C45424643479CE0D0C0525358555657' E0_EF 01060065
DC X'8C49CDCECBCFCCE1706ADEDBDC8D8EDF' F0_FF 01070065
* 01080056
CRLF DC XL2'0D0A' CARRIAGE RETURN + LINE FEED (SAUT DE LIGNE) 01110099
* 01120056
*- INPUT FILE 01130056
INPUT DCB DDNAME=INPUT,DSORG=PS,MACRF=(GM),EODAD=ENDFIC 01140099
* 01150056
*- OUTPUT FILE (MOVE MODE) 01160099
ASCII DCB DDNAME=ASCII,DSORG=PS,MACRF=(PM), &01170099
RECFM=FB,EXLST=EXLIST 01180099
* 01190056
APIFILE DCB DDNAME=APIFILE,DSORG=PS,MACRF=(PM), &01200099
RECFM=FB,LRECL=131,BLKSIZE=1310 01210091
* 01220099
PRINT OFF 01251099
DCBD DSORG=PS DSECT DCB 01252099
PRINT ON 01253099
* 01254099
END ASMSRCXF 01260056
* TRANSCODAGE - TR - EBCDIC 1147 ==> ASCII 00020056
*---------------------------------------------------------------------- 00040056
ASMSRCXF CSECT 00050056
INITL 10,EQU=R
*---------------------------------------------------------------------- 00070056
* MAIN 00080056
*---------------------------------------------------------------------- 00090056
BAL R6,OPEN_FIC OPEN 00100056
BAL R6,MAIN_TRT READ AND TRANSLATE 00110056
BAL R6,CLOSEFIC CLOSE 00120056
BAL R6,FIN_PGM EXIT 00130056
*---------------------------------------------------------------------- 00140056
* OPEN_FIC : 00150056
*---------------------------------------------------------------------- 00160056
OPEN_FIC EQU * 00170056
OPEN (APIFILE,(OUTPUT)) OPEN DEBUG FILE 00171099
OPEN (INPUT,(INPUT)) OPEN INPUT FILE 00180099
USING IHADCB,INPUT 00180199
LH R5,DCBLRECL R5 = LRECL 00180299
STH R5,LENGTH 00180399
AHI R5,2 R5 = LRECL + 2 00180599
STH R5,LENGTH_MOD 00180699
RDJFCB ASCII 00180899
MVC JFCLRECL,LENGTH_MOD 00180999
PUT APIFILE,JFCLRECL 00181099
OPEN (ASCII,(OUTPUT)),TYPE=J OPEN WITH MOD. JFCB 00182099
BR R6 00280099
* 00290056
*---------------------------------------------------------------------- 00300056
* MAIN_TRT : READ AND TRANSLATE 00310056
*---------------------------------------------------------------------- 00320056
MAIN_TRT EQU * 00330056
READFIC GET INPUT,DATAIN 00340068
TR DATAIN,EBTOAS EBDCI ==> ASCII 00350056
MVC2 MYOUT,DATAIN 00360077
MVC MYOUT+255(2),CRLF HERE WE ADD CR-LF 00370099
PUT ASCII,MYOUT 00380056
B READFIC 00390056
ENDFIC EQU * 00400056
CLOSE ASCII 00410056
FREEPOOL ASCII 00420056
BR R6 00430056
* 00440056
*---------------------------------------------------------------------- 00450056
* CLOSEFIC 00460056
*---------------------------------------------------------------------- 00470056
CLOSEFIC EQU * 00480056
CLOSE INPUT 00490068
CLOSE APIFILE 00500092
CLOSE ASCII 00510086
BR R6 00520056
* 00530056
*---------------------------------------------------------------------- 00540056
* FIN_PGM : EXIT 00550056
*---------------------------------------------------------------------- 00560056
FIN_PGM EQU * 00570056
RCNTL RC=0 00580056
* 00590056
*---------------------------------------------------------------------- 00600056
* WORKING STORAGE 00610056
*---------------------------------------------------------------------- 00620056
* 00639299
DS 0D 00639399
EXLIST DC X'87' 00639499
DC AL3(JFCB1) 00639599
JFCB1 DS 0CL176 DSECT JFCB 00639699
JFDSN DS CL44 DATA SET NAME 00639799
ORG JFCB1 00639899
PRINT OFF 00639999
IEFJFCBN 00640099
PRINT ON 00640199
ORG 00640299
* 00640399
MYOUT DS CL255 00641099
DATAIN DS CL255 00650099
LENGTH DS H 00651099
LENGTH_MOD DS H 00652099
* 00660056
*- EBCDCI 1147 ==> ASCII 00680056
*- 0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F- 00690056
EBTOAS DC 0CL256 00700056
DC X'000102039C09867F978D8E0B0C0D0E0F' 00_0F 00710064
DC X'101112139D8508871819928F1C1D1E1F' 10_1F 00720064
DC X'80818283840A171B88898A8B8C050607' 20_2F 00730064
DC X'909116939495960498999A9B14159E1A' 30_3F 00740064
DC X'20A0E2E440E1E3E55CF1BA2E3C282B21' 40_4F 00750064
DC X'267BEAEB7DEDEEEFECDFA7242A293B5E' 50_5F 00760064
DC X'2D2FC2C4C0C1C3C5C7D1F92C255F3E3F' 60_6F 00770064
DC X'F8C9CACBC8CDCECFCCB53AA3E0273D22' 70_7F 00780064
DC X'D8616263646566676869ABBBF0FDFEB1' 80_8F 00790064
DC X'5B6A6B6C6D6E6F707172AABAE6B8C680' 90_9F 00800064
DC X'6022737475767778797AA1BFD0DDDEAE' A0_AF 00810064
DC X'A223A5B7A95DB6BCBDBEAC7CAF7E92D7' B0_BF 00820067
DC X'E94142434445464748492DF4F6F2F3F5' C0_CF 00830064
DC X'E84A4B4C4D4E4F505152B9FBFCA6FAFF' D0_DF 00840064
DC X'E7F7535455565758595AB2D4D6D2D3D5' E0_EF 00850064
DC X'30313233343536373839B3DBDCD9DA20' F0_FF 00860064
* 00870056
*- ASCII ==> EBCDIC 1147 00890056
*- 0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F- 00900056
ASTOEB DC 0CL256 00910056
DC X'00010203372D2E2F1605250B0C0D0E9F' 00_0F 00920065
DC X'101112131415161718191A1B1C1D1E1F' 10_1F 00930065
DC X'404F7FB15B6C507D4D5D5C4E6B604B61' 20_2F 00940063
DC X'F0F1F2F3F4F5F6F7F8F97A5E4C7E6E6F' 30_3F 00950063
DC X'44C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6' 40_4F 00960063
DC X'D7D8D9E2E3E4E5E6E7E8E99048B55F6D' 50_5F 00970063
DC X'A0818283848586878889919293949596' 60_6F 00980063
DC X'979899A2A3A4A5A6A7A8A951BB54BD40' 70_7F 00990065
DC X'9F404040404040404040404C40404040' 80_8F 01000065
DC X'407DBE7FA14B6060BD40A26E40404040' 90_9F 01010067
DC X'40AAB07BB1B2DD5A40B49A8ABACAAFBC' A0_AF 01020065
DC X'4A8FEAFABE79B6B39DDA9B8BB7B8B9AB' B0_BF 01030066
DC X'6465626663679E687471727378757677' C0_CF 01040065
DC X'AC69EDEEEBEFECBF80FDFEFBFCADAE59' D0_DF 01050065
DC X'7C45424643479CE0D0C0525358555657' E0_EF 01060065
DC X'8C49CDCECBCFCCE1706ADEDBDC8D8EDF' F0_FF 01070065
* 01080056
CRLF DC XL2'0D0A' CARRIAGE RETURN + LINE FEED (SAUT DE LIGNE) 01110099
* 01120056
*- INPUT FILE 01130056
INPUT DCB DDNAME=INPUT,DSORG=PS,MACRF=(GM),EODAD=ENDFIC 01140099
* 01150056
*- OUTPUT FILE (MOVE MODE) 01160099
ASCII DCB DDNAME=ASCII,DSORG=PS,MACRF=(PM), &01170099
RECFM=FB,EXLST=EXLIST 01180099
* 01190056
APIFILE DCB DDNAME=APIFILE,DSORG=PS,MACRF=(PM), &01200099
RECFM=FB,LRECL=131,BLKSIZE=1310 01210091
* 01220099
PRINT OFF 01251099
DCBD DSORG=PS DSECT DCB 01252099
PRINT ON 01253099
* 01254099
END ASMSRCXF 01260056
Any idea is welcome.
Thanks