View previous topic :: View next topic
|
Author |
Message |
nithinlenin
New User
Joined: 06 Feb 2007 Posts: 19 Location: Hyderabad
|
|
|
|
I need to create a new file with columns from different file.
ie i have a file FILE1 with the 4 fields 'Name', 'address', 'phone' and 'balance'
i need to make a new file FILE2 with the fileds 'name' and 'balance' from FILE1 and alos another filed 'sex' from working storage.
Can i achieve the same using any JCL utilities or do i have to write a cobol prog for that |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Please post samples of what your inputs look like and how you expect your outputs to look. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can do this with DFSORT. What is the starting position, length and format of 'name' and 'balance' fields in the input record? What is the RECFM and LRECL of the input file? |
|
Back to top |
|
|
nithinlenin
New User
Joined: 06 Feb 2007 Posts: 19 Location: Hyderabad
|
|
|
|
THIS ARE MY INPUT
Code: |
01 FS-FDETL-REC.
05 FS-RECTYPE2 PIC X(05).
05 FS-SEQ PIC 9(10).
05 FS-BALDATE PIC X(08).
05 FS-STORE PIC X(04).
05 FS-DOLSIGN PIC X(01).
05 FS-DOL.
10 FS-DOL1 PIC 9(3).
10 FS-DOL2 PIC 9(14)V9(04).
05 FS-QTYSIGN PIC X(01).
05 FS-QTY PIC 9(08)V9(04).
05 FS-TRANDATE PIC X(08).
05 FS-REGID PIC X(04).
05 FS-TRANNO PIC X(04).
05 FS-VERNO PIC X(04).
05 FS-REV PIC X(01).
05 FS-ITEMSEQ PIC X(04).
05 FS-TRANTYPE PIC X(01).
05 FS-DEPT PIC X(04).
05 FS-CLASS PIC X(04).
05 FS-SUBCL PIC X(04).
05 FS-SKU PIC X(08).
05 FS-UPC PIC X(13).
05 FS-SATYPE PIC X(04).
05 FS-SASTAT PIC X(01).
05 FS-VOIDREG PIC X(04).
05 FS-VOIDTRAN PIC X(04).
05 FS-SERVTYPE PIC X(02). |
AND THE WORKING STORAGE VARIABLE
01 WS-SALESIGN PIC X(01).
AND OUT PUT SHOULD HAVE
FS-BALDATE
FS-TRANDATE
FS-STORE
FS-REGID
FS-TRANTYPE from the 1st file
and WS-SALESIGN from working storage |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Looks like you want to do it with COBOL.......
If WS-SALESIGN is somewhat constant, Sort could do it quite easily.....
Did I get the displacements and lengths correct?
16,08 05 FS-BALDATE PIC X(08).
24,04 05 FS-STORE PIC X(04).
62,08 05 FS-TRANDATE PIC X(08).
70,04 05 FS-REGID PIC X(04).
87,01 05 FS-TRANTYPE PIC X(01).
Did I get the lrecl correct?
lrecl 136
And what value should single byte of WS-SALESIGN be?
AND OUT PUT SHOULD HAVE
FS-BALDATE
FS-TRANDATE
FS-STORE
FS-REGID
FS-TRANTYPE
WS-SALESIGN |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
nithinlenin,
Here's a DFSORT job that will do what you asked for. I didn't know what WS-SALESIGN was, so I assumed it was a constant of 'A'. Change it appropriately.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
FS-RECTYPE2,1,5
FS-SEQ,*,10
FS-BALDATE,*,8
FS-STORE,*,4
FS-DOLSIGN,*,1
FS-DOL1,*,3
FS-DOL2,*,18
FS-QTYSIGN,*,1
FS-QTY,*,12
FS-TRANDATE,*,8
FS-REGID,*,4
FS-TRANNO,*,4
FS-VERNO,*,4
FS-REV,*,1
FS-ITEMSEQ,*,4
FS-TRANTYPE,*,1
WS-SALESIGN,'A'
/*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
OUTREC BUILD=(FS-BALDATE,FS-TRANDATE,FS-STORE,
FS-REGID,FS-TRANTYPE,WS-SALESIGN)
/*
|
|
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Dang, that SYMNAMES is neat...... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Glad you like it. |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
Frank,
When was this SYMNAMES introduced? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
|