URL: https://linuxfr.org/forums/programmation-shell/posts/allocation-fichier-en-entree-sortie Title: Allocation fichier en entrée / sortie Authors: judgelolo Date: 2012年03月22日T15:17:41+01:00 Tags: Score: 1 Bonjour à tous les pro du KSH Je débute dans ce langage, donc je cherche un peu (beaucoup) d'aide :pt1cable: :pt1cable: Je dois réécrire un source.sh car on bascule d'un domaine microfocus vers un domaine IBM. Pour cela, le sh actuel effectue des appels de fonction pour allouer des fichiers en entrée et en sortie mais comment bypasser ces fonctions ??? Détail, allocation de fichier pour appel d'un programme cobol En gros voici un extrait de code : Dans mon sh appel à la fonction : f_allocfcout00 WG X8FEA8KNTB Dans le cobol on a - SELECT WG-FICHIER ASSIGN UT-S-WG et la fonction f_allocfcout00 : function f_allocfcout00 { export filecode=$(f_calculnomf00 2ドル "W" )} puis la fonction f_calculnomf00 : function f_calculnomf00 { argument=1ドル argument2=2ドル nbz=$(echo $argument | awk ' { i=split(0,ドルs,"/" ); print i;}') # controle path complet ou uniquement nom du fichier if [ ${nbz} -eq 1 ]; then # argument = uniquement nom du fichier extent=$(echo $argument | awk ' { i=split(0,ドルs,"." ); print i;}'); # test nom fichier sans extension if [ ${extent} -gt 1 ]; then argument3=$(echo $argument | awk ' { i=split(0,ドルs,"." ); print s[1];}'); else argument3=$argument; fi carad=$(echo $argument3 | awk ' { lg=length(0ドル); i=substr(0,ドルlg-1,1); print i;}') card=$(echo $argument3 | awk ' { lg=length(0ドル); i=substr(0,ドルlg-1,2); print i;}') chemin=""; calculOK=''; if [ ${card} = 'BP' ] || [ ${card} = 'TS' ] || [ ${card} = 'TT' ] || [ ${card} = 'FV' ] || [ ${carad} = 'P' ] || [ ${carad} = 'X' ] || [ ${carad} = 'D' ] || [ ${carad} = 'I' ] || [ ${carad} = '1' ] || [ ${carad} = 'A' ]; then chemin=$X8_FICH_PERM; calculOK=O; if [ ${extent} -eq 1 ]; then # test generation automatique extension if [ ${argument2} = "R" ]; then argument=${argument}".0"; else argument=${argument}".tmp"; fi fi elif [ ${carad} = 'E' ] || [ ${carad} = 'T' ] || [ ${carad} = 'U' ]; then chemin=$X8_FICH_TMP_SAV; calculOK='O'; elif [ ${carad} = 'V' ]; then chemin=$X8_FICH_TMP_NOSAV; calculOK='O'; elif [ ${carad} = '0' ]; then chemin=$X8_FICH_PARAM; calculOK='O'; elif [ ${carad} = 'F' ] || [ ${carad} = 'W' ] || [ ${carad} = 'Y' ]; then chemin=$X8_FICH_TRANSF; calculOK='O'; elif [ ${carad} = 'R' ]; then chemin=$X8_FICH_INT_APP_ENT; calculOK='O'; elif [ ${carad} = 'Z' ] && [ ${argument2} = "R" ]; then chemin=$X8_FICH_INT_APP_ENT; calculOK='O'; elif [ ${carad} = 'Z' ]; then chemin=$X8_FICH_INT_APP_SOR; calculOK='O'; elif [ ${carad} = 'K' ]; then chemin=$X8_FICH_ORACLE; calculOK='O'; elif [ ${carad} = 'L' ]; then chemin=$X8_SAS_UG; calculOK='O'; else chemin="" fi if [ "${calculOK}" = 'O' ]; then if [ "${chemin}" != "" ]; then echo $LMDATA"/"${chemin}"/"${argument}; else echo $LMDATA"/"${argument}; fi else export RETCODE=1; fi else echo 1ドル fi } MA QUESTION : Comment faire dans mon nouveau sh pour éviter l'appel à ces fonctions et mettre en "dur" le nom du chemin et l'allocation de mon fichier wg ?? en vous remerciant d'avance