quarta-feira, outubro 28, 2015

Alterar o Formato de um Campo no Adabas

O analista quando vai criar um file ele planeja os tipos de campos que os dados irão gravar em cada campo. Por exemplo, para armazenar o CPF, ele defini um campo do tipo numérico. Se for armazenar nomes e endereços, vai definir um ou mais campos para o tipo alfanumérico e assim por diante. No Adabas 7.4.4 (não sei em versões acima) depois que o campo é criado "fisicamente" para alterar o formato de um campo dá um pouco de trabalho pois tem que ser feito alguns procedimentos (um deles é deletar o file) para converter o formato, a primeira coisa a ser feita é rodar um backup (adauld) no file, depois que tem que ser descompactado (adacmp decompress) os dados do adauld, deletar o file e restaurar os dados comprimidos (adacmp compress) neste ultimo passo que dá para alterar o formato do campo em questão, isso tudo envolve uma parada do sistema do analista pois o file vai ficar indisponível até o termino desse procedimento, este tutorial vamos mostrar como se faz isso, vamos alterar um formato (N) numérico para (A) alfa.

Iniciando

Criando um arquivo - onde vamos fazer um backup do file rodando o utilitário ADAULD;
MEMBER=IEFBRACC 000018 REC SAVE:20.10.2015 18:01 BY   USERID UU01055  R=00000001
DSN=DBA.ADAB.JCLS                                LIB=S3 VOL=PRL303 UNIT=1126
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
//AAFSNATB JOB (AAF,TSS),'CSA',CLASS=S,MSGCLASS=A
//*UQ ALLOW
//* ----------------------------------------------------------------
//*                     CRIANDO DOIS DATASETS
//* ----------------------------------------------------------------
//IEFBR14  EXEC PGM=IEFBR14
//SYSUT1   DD   DSN=DBA.S.F50.DB010.COMPR,DISP=(,CATLG,DELETE),
//         VOL=SER=PRD27A,SPACE=(CYL,(15,4)),UNIT=SYSDA,
//         DCB=(RECFM=VB,BLKSIZE=0,LRECL=0,DSORG=PS)
/*
Importante Destacar

Qual é a diferente entre o ADAULD e do ADASAV, lento a documentação desses dois fazem backup de arquivos?
Na verdade, o ADAULD descarrega os registros para um arquivo sequencial, não levando a estrutura do file. E o ADAULD trabalha em nível de registros / ISNs. Já o ADASAV, efetua o backup propriamente dito, incluindo as estruturas do arquivo. E o mesmo trabalha em nível de blocos / RABNs. Você até pode executar um ADAULD / ADALOD de um file, de um banco para outro. Porém, será mais demorado do que efetuar um ADASAV SAVE / RESTORE.
ADAULD

Vamos pegar os dados de um file do Adabas e gravar em um dataset - Ainda esta comprimido;
MEMBER=ADAULD   000014 REC SAVE:20.10.2015 18:03 BY   USERID UU01055  R=00000001
DSN=DBA.ADAB.JCLS                                LIB=S3 VOL=PRL303 UNIT=1126
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
//AAFPSAVE JOB (AAFP,DIBD),CLAU,CLASS=S,MSGCLASS=A TYPRUN=HOLD
//*UQ ALLOW
//* --------------------------------------------------------------
//*                 SALVANDO ARQUIVOS DO DE UM BANCO
//* --------------------------------------------------------------
//ULD297    EXEC AAFAU010,TIME=1440
//DDOUT1   DD   DSN=DBA.S.F50.DB010.COMPR,DISP=SHR
//* --------------------------------------------------------------
//DDCARD    DD *
ADARUN PROG=ADAULD,DBID=010
//DDKARTE   DD *
ADAULD FILE=50
/*
O arquivo adauld esta assim (comprimido);
                                                                     R=00000001
DSN=DBA.S.F50.DB010.COMPR                               VOL=PRD27A UNIT=3100
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
{. .  H.                        .P...AA...   ..AB...   ..AC...   ..AD...   ..AE.
.    ..AF..    ..AG..    ..AH..    ..AI+.    *.AJ+.    ..AK+.    Y.BA...   :.BB.
..   d.BC..    ..BD..    q.CA...   s.CB..    ..CC..    ..DA...   {.DB..    ..DC.
.    M.DE..    ..DF..     .AL..    2.AM...   ..AN..   ...AO..   ...AP...  ...AQ.
.   ...AY...   ..AR...  ...AS..   ...AT...  .<.AU..   ...AV+.   .-.AW...  .¦.AX.
..  .. . ..   AA .AH .AO..AV..BD .DE M.. . ..S1... . .... .....S2... . .... ....
.S3... ...a............
ADACMP DECOMPRESS

No Adabas os registros estão compactados - Vamos descompactar este arquivo para poder ver os registros;
MEMBER=ADACMPP  000021 REC SAVE:29.09.2015 16:01 BY   USERID UU01055  R=00000001
DSN=DBA.ADAB.JCLS                                LIB=S3 VOL=PRL303 UNIT=1126
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
//AAFPC050 JOB (AAFA,DIBD),DBA,CLASS=S,MSGCLASS=A,TYPRUN=HOLD
//*UQ ALLOW
//* --------------------------------------------------------------
//*                ADACMP DECOMPRESS FILE 50
//* --------------------------------------------------------------
//ADACMP   EXEC AAFAU010
//DDEBAND  DD DSN=DBA.S.F50.DB010.COMPR,         
//         DISP=OLD,UNIT=SYSDA,
//         VOL=SER=PRD27A
//* --------------------------------------------------------------
//DDAUSBA  DD DSN=DBA.S.F50.DB010.DECOM,          
//         UNIT=SYSDA,
//         DISP=(NEW,CATLG,DELETE),
//         VOL=SER=PRD27A,SPACE=(CYL,(10,5)),
//         DCB=(LRECL=80,BLKSIZE=6160,RECFM=VB,DSORG=PS)
//* --------------------------------------------------------------
//DDFEHL   DD DSN=&&FEHL,UNIT=SYSDA,DISP=(NEW,DELETE),
//         SPACE=(TRK,1)
//DDCARD   DD *
ADARUN PROG=ADACMP,DBID=010
//DDKARTE  DD *
ADACMP DECOMPRESS
/*
Resultado do Job;
1
A D A C M P   V7.4  SM4   DBID = 00010  Started           2015-09-29  15:52:50

Parameters:
-----------

ADACMP DECOMPRESS

 DECOMPRESS Processing Statistics:
 ---------------------------------

 Number of records read                       67

 Number of incorrect records                   0

 Number of DECOMPRESSED records               67


A D A C M P  Terminated normally                          2015-09-29  15:52:50
UQS0009 - END OF DATA SET.
Arquivo Descomprimido;
                                                                     R=00000001
DSN=DBA.S.F50.DB010.DECOM                               VOL=PRD27A UNIT=3100
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00000000        000000000000                    000000000000.
                                                           .
                                                          .
                                                         00000000        000000
00000000D02     FREDDIE MERCURY CANTA MUITO                         000000100



         0000000000000000
                       00000000
00000000        000000000000                    000000000000.
                                                           .
                                                          .
                                                         00000000        000000
00000000B01     KLB TEM MUSICAS BOAS                      000000100



         0000000000000000
                       00000000
ADACMP : Compress

Antes de rodar o COMPRESS temos que pegar as definições desse file, acesse o predict
16:08:42             *****  P R E D I C T  4.4.1  *****              2015-09-29
Plan   0                   - Function Main Menu -                Profile SYSTEM

       Documentation                      External objects

       A  Active retrieval                F  File implementation
       M  Maintenance                     G  Generation
       R  Retrieval                       I  Incorporation
       X  List xref for 3GL               C  Comparison
                                          L  Administration

       DDA services                       Miscellaneous

       D  Defaults                        W  What is new ?
       S  Special functions               ?  Help system
                                          .  Leave Predict

Function ........ M
Object type ....* FI                  Menu type ....* F

Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  E-el  Flip  Print Impl  Acmp  Ssec  Prof  Main
Selecionando S
16:09:22             *****  P R E D I C T  4.4.1  *****              2015-09-29
Plan   0                 - (FI) File Maintenance -               Profile SYSTEM

 Function                              Function

 A  Add a file                         L  Link children
 C  Copy file                          S  Select file from a list
 M  Modify file                        B  Push backward
 N  Rename/Renumber file               F  Force standard
 P  Purge file                         J  Physical Attributes
 D  Display file                       K  Modify Vista elements

Function ......... S
File ID ..........                                  Attributes ........*
Copy ID ..........                                  File of type ......*
Contained in DA ..                                  File nr ............ 50
External name ....

Restrictions ....*   Profile Default,empty          Association .......*

Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  E-el  Flip  Print Impl  Acmp  Ssec  Prof  Main
Depois de selecionar o file com X (enter)
16:09:57             *****  P R E D I C T  4.4.1  *****              2015-09-29
Plan   0                      - Select File -

Cmd  File ID                            Type   Fnr    DDM Impl Other

 X_  * MANU-ASSIST-TECNICA               A      50         A
 __  * MANV-AT-EQUIPAMENTOS              U      50     *         *
 __  * MANV-AT-HISTORICO                 U      50     *         *
 __  * MANV-AT-OC-EQ                     U      50     *         *
 __  * MANV-AT-OCORRENCIAS               U      50     *         *
 __  * MANV-AT-SERVICOS                  U      50     *         *
 __  * MANV-AT-TAB-GRUPO                 U      50     *         *
 __  * MANV-AT-TAB-SERV                  U      50     *         *
Tecle PF3
DIC2793 FILE SELECTED.
16:10:04             *****  P R E D I C T  4.4.1  *****              2015-09-29
Plan   0                 - (FI) File Maintenance -               Profile SYSTEM

 Function                              Function

 A  Add a file                         L  Link children
 C  Copy file                          S  Select file from a list
 M  Modify file                        B  Push backward
 N  Rename/Renumber file               F  Force standard
 P  Purge file                         J  Physical Attributes
 D  Display file                       K  Modify Vista elements

Function .........
File ID .......... MANU-ASSIST-TECNICA              Attributes ........*
Copy ID ..........                                  File of type ......*
Contained in DA ..                                  File nr ............ 50
External name ....

Restrictions ....*   Profile Default,empty          Association .......*

Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  E-el  Flip  Print Impl  Acmp  Ssec  Prof  Main
Opção G/AC
DIC2805 EXECUTION STOPPED WITH PF-KEY.
16:10:59             *****  P R E D I C T  4.4.1  *****              2015-09-29
Plan   0                   - Function Main Menu -                Profile SYSTEM

       Documentation                      External objects

       A  Active retrieval                F  File implementation
       M  Maintenance                     G  Generation
       R  Retrieval                       I  Incorporation
       X  List xref for 3GL               C  Comparison
                                          L  Administration

       DDA services                       Miscellaneous

       D  Defaults                        W  What is new ?
       S  Special functions               ?  Help system
                                          .  Leave Predict

Function ........ G
Object type ....* AC                  Menu type ....* F

Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  E-el  Flip  Print Impl  Acmp  Ssec  Prof  Main
Vamos salvar as definições dos campos do file em uma biblioteca Natural chamada ADACMP com o nome do membro MANUF050
16:11:22             *****  P R E D I C T  4.4.1  *****              2015-09-29
Plan   0           - Generate ADACMP/ADAWAN Definitions -

File ID ...............* MANU-ASSIST-TECNICA
Phys. File number.......
Contained in DA ........
Phys. Database number ..

Save as member ......... MANUF050                Save in library .... ADACMP
Overwrite option ....... N      (Y,N)            Op. system member ..
Punch / output ........* N
Generate loader ........ N      (Y,N)            UES ................ N  (Y,N)
List generated code .... Y      (Y,N)            Adabas version ....* I7
List input file .......* Y
Input file ID ..........
NUMREC .................        (-1=zero)        Cipher code ........
Occurrences used ......* Y
Record length ..........        (*,number)       Record format .....*
Device statistics ...... Y      (Y,N)

Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  E-el  Flip  Print Impl  Acmp  Ssec  Prof  Main
Salvando as definições dos campos
MORE
16:12:34             *****  P R E D I C T  4.4.1  *****             2015-09-29
                       - Generate ADACMP Definitions -               Page:   1

File ID .. MANU-ASSIST-TECNICA

ADACMP COMPRESS
ADACMP FILE=50
ADACMP MINISN=1
ADACMP DEVICE=8391
ADACMP FNDEF='01,AA,1,A,DE,FI'               OC-STATUS        **********
ADACMP FNDEF='01,AB,8,U,DE,NU'               OC-NUMERO        2015-09-29
ADACMP FNDEF='01,AC,8,A,NU'                  OC-GRUPO          16:12:34
ADACMP FNDEF='01,AD,8,U,NU'                  OC-DATA          **********
ADACMP FNDEF='01,AE,4,U,NU'                  OC-HORA
ADACMP FNDEF='01,AF,20,A,NU'                 OC-RESPONSAVEL
ADACMP FNDEF='01,AG,8,U,NU'                  OC-DATA-SOL
ADACMP FNDEF='01,AH,4,U,NU'                  OC-HORA-SOL
ADACMP FNDEF='01,AI,78,A,NU,MU'              OC-PROBLEMA
ADACMP FNDEF='01,AJ,78,A,NU,MU'              OC-ACOES
ADACMP FNDEF='01,AK,78,A,NU,MU'              OC-SOLUCAO
ADACMP FNDEF='01,BA,8,U,DE,NU'               TP-NUMERO
ADACMP FNDEF='01,BB,8,A,DE,NU'               TP-TIPO
ADACMP FNDEF='01,BC,5,U,NU'                  TP-QTE
Feito;
DIC2658 GENERATED CODE SAVED AS MEMBER ' MANUF050 '.
16:12:47             *****  P R E D I C T  4.4.1  *****              2015-09-29
Plan   0           - Generate ADACMP/ADAWAN Definitions -

File ID ...............* MANU-ASSIST-TECNICA
Phys. File number....... 50
Contained in DA ........ DB.D010.HOMOLOG
Phys. Database number .. 010

Save as member ......... MANUF050                Save in library .... ADACMP
Overwrite option ....... N      (Y,N)            Op. system member ..
Punch / output ........* N
Generate loader ........ N      (Y,N)            UES ................ N  (Y,N)
List generated code .... Y      (Y,N)            Adabas version ....* I7
List input file .......* Y
Input file ID ..........
NUMREC .................        (-1=zero)        Cipher code ........
Occurrences used ......* Y
Record length ..........        (*,number)       Record format .....*
Device statistics ...... Y      (Y,N)

Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  E-el  Flip  Print Impl  Acmp  Ssec  Prof  Main
Na biblioteca ADACMP vamos chamar o programa MANUF050
16:13:14                    *****  NATURAL  *****                    29/09/2015
User UU01055                    - Main Menu -                Library ADACMP


                   Function

                _  Development Functions
                _  Development Environment Settings
                _  Maintenance and Transfer Utilities
                _  Debugging and Monitoring Utilities
                _  Example Libraries
                _  Other Products
                _  Help
                _  Exit Natural Session






Logon accepted to library ADACMP.
Command ===> e MANUF050
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help        Exit                                                  Canc
Vendo os campos do file 50 em uma biblioteca Natural;
>                                       > +  Program     MANUF050 Lib ADACMP
Top    ....+....1....+....2....+....3....+....4....+....5....+....6....+....7..
  0010 ADACMP COMPRESS
  0010 ADACMP FILE=50
  0010 ADACMP MINISN=1
  0010 ADACMP DEVICE=8391
  0010 ADACMP FNDEF='01,AA,1,A,DE,FI'               OC-STATUS        **********
  0010 ADACMP FNDEF='01,AB,8,U,DE,NU'               OC-NUMERO        2015-09-29
  0010 ADACMP FNDEF='01,AC,8,A,NU'                  OC-GRUPO          16:12:34
  0010 ADACMP FNDEF='01,AD,8,U,NU'                  OC-DATA          **********
  0010 ADACMP FNDEF='01,AE,4,U,NU'                  OC-HORA
  0010 ADACMP FNDEF='01,AF,20,A,NU'                 OC-RESPONSAVEL
  0010 ADACMP FNDEF='01,AG,8,U,NU'                  OC-DATA-SOL
  0010 ADACMP FNDEF='01,AH,4,U,NU'                  OC-HORA-SOL
  0010 ADACMP FNDEF='01,AI,78,A,NU,MU'              OC-PROBLEMA
  0010 ADACMP FNDEF='01,AJ,78,A,NU,MU'              OC-ACOES
  0010 ADACMP FNDEF='01,AK,78,A,NU,MU'              OC-SOLUCAO
  0010 ADACMP FNDEF='01,BA,8,U,DE,NU'               TP-NUMERO
  0010 ADACMP FNDEF='01,BB,8,A,DE,NU'               TP-TIPO
  0010 ADACMP FNDEF='01,BC,5,U,NU'                  TP-QTE
  0010 ADACMP FNDEF='01,BD,9,U,NU'                  TP-VALOR-COBRADO
  0010 ADACMP FNDEF='01,CA,8,A,DE,NU'               TB-TP-TIPO
       ....+....1....+....2....+....3....+....4....+....5....+... S 44   L 1
ADACMP COMPRESS

O jcl abaixo vamos fazer:

1 - Pegar o arquivo descompactado e compactar;
2 - Deletar o file do banco (50);
3 - Carregar o arquivo compactado no banco usando o utilitário LOAD;
MEMBER=ADACM095 000019 REC SAVE:25.05.2005 15:04 BY   USERID UU01055  R=00000001
DSN=DBA.ADAB.JCLS                                LIB=S3 VOL=PRL303 UNIT=1126
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
//AAFPC050 JOB (AAFA,DIBD),DBA,CLASS=S,MSGCLASS=A,TYPRUN=HOLD
//*UQ ALLOW
//* --------------------------------------------------------------
//* ADACMP COMPRESS FILE 50
//* --------------------------------------------------------------
//UTIL     EXEC AAFAU010
//DDEBAND  DD DSN=DBA.S.F50.DB010.DECOM,          
//         DISP=OLD,UNIT=SYSDA,
//         VOL=SER=PRD27A
//* --------------------------------------------------------------
//DDAUSBA  DD DSN=DBA.S.F50.DB010.COMPR2,          
//         UNIT=SYSDA,
//         DISP=(NEW,CATLG,DELETE),
//         VOL=SER=PRD27A,SPACE=(CYL,(10,5)),
//         DCB=(LRECL=80,BLKSIZE=6160,RECFM=VB,DSORG=PS)
//* --------------------------------------------------------------
//DDFEHL   DD DSN=&&FEHL,UNIT=SYSDA,DISP=(NEW,DELETE),
//         SPACE=(TRK,1)
//DDCARD  DD *
ADARUN  PROG=ADACMP
//DDKARTE DD *
ADACMP COMPRESS
ADACMP FILE=50
ADACMP MINISN=1
ADACMP DEVICE=8391
ADACMP FNDEF='01,AA,1,A,DE,FI'               OC-STATUS        **********
ADACMP FNDEF='01,AB,8,A,DE,NU'               OC-NUMERO        2015-09-29
ADACMP FNDEF='01,AC,8,A,NU'                  OC-GRUPO          16:23:21
ADACMP FNDEF='01,AD,8,U,NU'                  OC-DATA          **********
ADACMP FNDEF='01,AE,4,U,NU'                  OC-HORA
ADACMP FNDEF='01,AF,20,A,NU'                 OC-RESPONSAVEL
ADACMP FNDEF='01,AG,8,U,NU'                  OC-DATA-SOL
ADACMP FNDEF='01,AH,4,U,NU'                  OC-HORA-SOL
ADACMP FNDEF='01,AI,78,A,NU,MU'              OC-PROBLEMA
ADACMP FNDEF='01,AJ,78,A,NU,MU'              OC-ACOES
ADACMP FNDEF='01,AK,78,A,NU,MU'              OC-SOLUCAO
ADACMP FNDEF='01,BA,8,U,DE,NU'               TP-NUMERO
ADACMP FNDEF='01,BB,8,A,DE,NU'               TP-TIPO
ADACMP FNDEF='01,BC,5,U,NU'                  TP-QTE
ADACMP FNDEF='01,BD,9,U,NU'                  TP-VALOR-COBRADO
ADACMP FNDEF='01,CA,8,A,DE,NU'               TB-TP-TIPO
ADACMP FNDEF='01,CB,50,A,NU'                 TB-TP-DESCRICAO
ADACMP FNDEF='01,CC,9,U,NU'                  TB-TP-VALOR-UNITARIO
ADACMP FNDEF='01,DA,8,A,DE,NU'               TB-GR-GRUPO
ADACMP FNDEF='01,DB,50,A,NU'                 TB-GR-DESCRICAO
ADACMP FNDEF='01,DC,50,A,NU'                 TB-GR-ENDERECO
ADACMP FNDEF='01,DE,20,A,NU'                 TB-GR-CONTATO
ADACMP FNDEF='01,DF,15,A,NU'                 TB-GR-TELEFONE
ADACMP FNDEF='01,AL,5,A,NU'                  TB-EQ-TIPO
ADACMP FNDEF='01,AM,20,A,DE,NU'              TB-EQ-SERIE
ADACMP FNDEF='01,AN,15,A,NU'                 TB-EQ-MARCA
ADACMP FNDEF='01,AO,15,A,NU'                 TB-EQ-MODELO
ADACMP FNDEF='01,AP,8,A,DE,NU'               TB-EQ-CLIENTE
ADACMP FNDEF='01,AQ,20,A,NU'                 TB-EQ-LOCAL
ADACMP FNDEF='01,AY,1,A,FI'                  TB-HI-STATUS
ADACMP FNDEF='01,AR,20,A,NU'                 TB-HI-SERIE
ADACMP FNDEF='01,AS,8,A,NU'                  TB-HI-CLIENTE
ADACMP FNDEF='01,AT,8,U,NU'                  TB-HI-DATA-INST
ADACMP FNDEF='01,AU,8,U,NU'                  TB-HI-DATA-DESINST
ADACMP FNDEF='01,AV,78,A,NU'                 TB-HI-MOTIVO
ADACMP FNDEF='01,AW,8,U,DE,NU'               TB-SE-NUMERO
ADACMP FNDEF='01,AX,20,A,DE,NU'              TB-SE-SERIE
ADACMP SUPDE='S1=AC(1,8),AD(1,8)'            OC-GR-DT
ADACMP SUPDE='S2=AD(1,8),AC(1,8)'            OC-DT-GR
ADACMP SUPDE='S3=AY(1,1),AR(1,20),AT(1,8)'   TB-HI-ST-SERIE-DT
//* ----------------------------------------------------------
//* DELETANDO O FILE DO ADABAS DO BANCO
//* ----------------------------------------------------------
//DELETE    EXEC AAFAU010,TIME=1440
//DDCARD    DD *
ADARUN PROG=ADADBS,DBID=010
//DDKARTE   DD *
ADADBS      DELETE FILE=50
//* --------------------------------------------------------------
//* CARREGANDO NO BANCO OS DADOS COMPACTADOS
//* --------------------------------------------------------------
//LOAD     EXEC AAFAU010,COND=(0,NE)
//DDEBAND  DD DSN=DBA.S.F50.DB010.COMPR2,         
//         DISP=OLD,UNIT=SYSDA,
//         VOL=SER=PRD27A
//DDCARD   DD *
ADARUN PROG=ADALOD,DBID=010,PLOGRQ=NO
ADARUN LP=10000,LWKP2=3000,LWP=500000
//DDKARTE  DD *
ADALOD  LOAD   FILE=050
ADALOD         NAME='MANU-ASSIST-TECN'
ADALOD         MAXISN=22047,DSSIZE=1000B
ADALOD         NISIZE=500B,UISIZE=100B
ADALOD         TEMPSIZE=500,SORTSIZE=500
ADALOD         INDEXCOMPRESSION=YES
/*
Detalhe Importante

O Campo AB estava U - numérico
ADACMP COMPRESS
ADACMP FILE=50
ADACMP MINISN=1
ADACMP DEVICE=8391
ADACMP FNDEF='01,AA,1,A,DE,FI'               OC-STATUS        **********
ADACMP FNDEF='01,AB,8,U,DE,NU'               OC-NUMERO        2015-09-29
ADACMP FNDEF='01,AC,8,A,NU'                  OC-GRUPO          16:23:21
ADACMP FNDEF='01,AD,8,U,NU'                  OC-DATA          **********
Observe o campo AB agora ficou como Alfa
ADACMP COMPRESS
ADACMP FILE=50
ADACMP MINISN=1
ADACMP DEVICE=8391
ADACMP FNDEF='01,AA,1,A,DE,FI'               OC-STATUS        **********
ADACMP FNDEF='01,AB,8,A,DE,NU'               OC-NUMERO        2015-09-29
ADACMP FNDEF='01,AC,8,A,NU'                  OC-GRUPO          16:23:21
ADACMP FNDEF='01,AD,8,U,NU'                  OC-DATA          **********
O formato U no SYSAOS é formato (N) numérico vamos alterar para (A) Alfa
+-----------------+--------+------------------+---------------------------------------------+
| Formato         | Código | Tamanho Máximo   | Observação                                  |
+-----------------+--------+------------------+---------------------------------------------+
| Alfanumérico    | A      | 253              |                                             |
+-----------------+--------+------------------+---------------------------------------------+
| Numérico        | N      | 27               | Máximo de 7 decimais                        |
+-----------------+--------+------------------+---------------------------------------------+
| Compactado      | P      | 27               | Máximo de 7 decimais                        |
+-----------------+--------+------------------+---------------------------------------------+
| Inteiro         | I      | 1, 2 ou 4        | I1 – valores de -128 até 127                |
+-----------------+--------+------------------+---------------------------------------------+
|                                             | I2 – valores de -32768 até 32767            |
+-----------------+--------+------------------+---------------------------------------------+
|                                             | I4 – valores de -2147483648 até +2147483647 |
+-----------------+--------+------------------+---------------------------------------------+
| Data            | D      |                  |                                             |
+-----------------+--------+------------------+---------------------------------------------+
| Hora            | T      |                  |                                             |
+-----------------+--------+------------------+---------------------------------------------+
| Lógico          | L      |                  | TRUE ou FALSE                               |
+-----------------+--------+------------------+---------------------------------------------+
| Binário         | B      | 126              |                                             |
+-----------------+--------+------------------+---------------------------------------------+
| Controle        | C      |                  | Atributo de controle de mapas               |
+-----------------+--------+------------------+---------------------------------------------+
| Ponto Flutuante | F      | 4, 8             |                                             |
+-----------------+--------+------------------+---------------------------------------------+
Resultado do Job;
1                       J E S 2  J O B  L O G  --  S Y S T E M  C P A C  --  N O
0
17.29.24 JOB05761 ---- TUESDAY,   29 SEP 2015 ----
17.29.24 JOB05761  TSS7000I UU01055 Last-Used 29 Sep 15 17:27 System=CPAC Facil
17.29.24 JOB05761  TSS7001I Count=55380 Mode=Fail Locktime=None Name=CSA
17.29.24 JOB05761  $HASP373 AAFPC050 STARTED - INIT K    - CLASS S - SYS CPAC
17.29.24 JOB05761  IEF403I AAFPC050 - STARTED - TIME=17.29.24
17.29.24 JOB05761  -                                              --TIMINGS (MI
17.29.24 JOB05761  -STEPNAME PROCSTEP    RC   EXCP   CONN    TCB    SRB  CLOCK
17.29.24 JOB05761  -UTIL     AAFAU010    00    108     25    .00    .00     .0
17.29.24 JOB05761  -DELETE   AAFAU010    00     57     16    .00    .00     .0
17.29.24 JOB05761  -LOAD     AAFAU010    00    279     55    .00    .00     .0
17.29.24 JOB05761  IEF404I AAFPC050 - ENDED - TIME=17.29.24
17.29.24 JOB05761  -AAFPC050 ENDED.  NAME-DBA                  TOTAL TCB CPU TI
17.29.24 JOB05761  $HASP395 AAFPC050 ENDED
0------ JES2 JOB STATISTICS ------
-  29 SEP 2015 JOB EXECUTION DATE
-           91 CARDS READ
-          609 SYSOUT PRINT RECORDS
-            0 SYSOUT PUNCH RECORDS
-           26 SYSOUT SPOOL KBYTES
--------------------------------------------------------------------------------
OP=S CL=ALL IN=ALL JB=AAFPC050,05761 DS=1 SI=SM LR=1 LL=80 PP=0 DC= RL=999999
AD=J DE= SC= PT= SQ=C RR=0 OC= SD=2000   29.09.2015, 17:31:52
Rodou ok
 IEF142I AAFPC050 AAFAU010 UTIL - STEP WAS EXECUTED - COND CODE 0000
 IEF142I AAFPC050 AAFAU010 DELETE - STEP WAS EXECUTED - COND CODE 0000
 IEF142I AAFPC050 AAFAU010 LOAD - STEP WAS EXECUTED - COND CODE 0000
Checando

File carregado
 17:34:25          ***** A D A B A S  BASIC  SERVICES *****       2015-09-29
 DBID 010                    - Display File Layout -                 PDRF012
  ****************
  *  File 50     *   MANU-ASSIST-TECN
  ****************

  Records loaded ..... 67            Date loaded .......... 2015-09-29 17:29:24
  Top ISN ............ 67
  Max ISN expected ... 22047         Max Compr Rec Lngth .. 10792
  Minimum ISN ........ 1             Asso/Data Padding .... 10%/10%
  Size of ISN ........ 3 Bytes       Highest Index Level .. 3
  Number of Updates .. 0             Index Compression .... YES
  ISN Reusage ........ NO            USERISN .............. NO
  Space Reusage ...... YES           MIXDSDEV ............. NO
  ADAM File .......... NO            PGMREFRESH ........... NO
  Ciphered File ...... NO            NOACEXTENSION ........ NO
  Coupled Files ...... NONE
  Blk per DS Extent .. 0
  Blk per UI Extent .. 0             Total Changed Blks ... 45
  Blk per NI Extent .. 0             Length of Owner ID ... 0

 PF1----- PF2------ PF3------ PF4------ PF6----- PF7----- PF8----- PF12-----
 Help               Exit      Refresh                              Menu
Carregado no banco 010;
 17:34:41          ***** A D A B A S  BASIC  SERVICES *****       2015-09-29
 DBID 010                   - Display File Layout -                  PDRF022
 File 50

    I Dev  LiI  Space allocated  I      From         To    I Unused
    I Type TyI  Blocks   / Cyls. I      RABN         RABN  I BLOCKS  /  Cyls.
----I--------I-------------------I ------------------------I------------------
    I        I                   I                         I
ASSOI 8391 ACI       16        0 I     115775 -     115790 I        0        0
    I 8391 UII      100        0 I     116291 -     116390 I       86        0
    I 8391 NII      500        2 I     115791 -     116290 I      487        2
    I        I                   I                         I
DATAI 8391 DSI     1000       13 I     255511 -     256510 I      999       13








 PF1----- PF2------ PF3------ PF4------ PF6----- PF7----- PF8----- PF12-----
 Help               Exit      Refresh                              Menu
Antes/Depois

Antes de fazer este procedimento o campo AB ele estava como U;
 18:28:40          ***** A D A B A S  BASIC  SERVICES *****       2015-10-20
 DBID 010                       - Display FDT -                      PDRD002

  Field Description Table: File 50    (MANU-ASSIST-TECN)
  ========================                Total Fields without SDT ... 37
  *************** T o p  of  F D T ***************
  Lev  I Name I Leng  I Form  I    Options       I Predict Field Names
  -----I------I-------I-------I----------------- I-----------------------------
    1  I  AA  I  001  I    A  I  DE FI           I
    1  I  AB  I  008  I    U  I  DE NU           I
    1  I  AC  I  008  I    A  I  NU              I
    1  I  AD  I  008  I    U  I  NU              I
    1  I  AE  I  004  I    U  I  NU              I
    1  I  AF  I  020  I    A  I  NU              I
    1  I  AG  I  008  I    U  I  NU              I
    1  I  AH  I  004  I    U  I  NU              I
    1  I  AI  I  078  I    A  I  MU NU           I
    1  I  AJ  I  078  I    A  I  MU NU           I
    1  I  AK  I  078  I    A  I  MU NU           I
    1  I  BA  I  008  I    U  I  DE NU           I

 PF1----- PF2------ PF3------ PF4------ PF6----- PF7----- PF8----- PF12-----
 Help     Disp SDT  Exit                --       -        +        Menu
Depois de realizado este procedimento o campo AB agora esta como alfa no fisico;
 18:21:03          ***** A D A B A S  BASIC  SERVICES *****       2015-10-20
 DBID 010                       - Display FDT -                      PDRD002

  Field Description Table: File 50    (MANU-ASSIST-TECN)
  ========================                Total Fields without SDT ... 37
  *************** T o p  of  F D T ***************
  Lev  I Name I Leng  I Form  I    Options       I Predict Field Names
  -----I------I-------I-------I----------------- I-----------------------------
    1  I  AA  I  001  I    A  I  DE FI           I
    1  I  AB  I  008  I    A  I  DE NU           I
    1  I  AC  I  008  I    A  I  NU              I
    1  I  AD  I  008  I    U  I  NU              I
    1  I  AE  I  004  I    U  I  NU              I
    1  I  AF  I  020  I    A  I  NU              I
    1  I  AG  I  008  I    U  I  NU              I
    1  I  AH  I  004  I    U  I  NU              I
    1  I  AI  I  078  I    A  I  MU NU           I
    1  I  AJ  I  078  I    A  I  MU NU           I
    1  I  AK  I  078  I    A  I  MU NU           I
    1  I  BA  I  008  I    U  I  DE NU           I

 PF1----- PF2------ PF3------ PF4------ PF6----- PF7----- PF8----- PF12-----
 Help     Disp SDT  Exit                --       -        +        Menu
Este exemplo o campo alterado o formato não estava em um superdescritor, se estivesse teria que observar o formato do superdescritor;

0 comentários:

Enviar um comentário