IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Creating a new file from more than 1 input files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nithinlenin

New User


Joined: 06 Feb 2007
Posts: 19
Location: Hyderabad

PostPosted: Fri Jun 15, 2007 8:16 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jun 15, 2007 9:21 pm
Reply with quote

Please post samples of what your inputs look like and how you expect your outputs to look.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jun 15, 2007 9:23 pm
Reply with quote

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
View user's profile Send private message
nithinlenin

New User


Joined: 06 Feb 2007
Posts: 19
Location: Hyderabad

PostPosted: Fri Jun 15, 2007 9:45 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jun 15, 2007 10:16 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jun 16, 2007 1:36 am
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sat Jun 16, 2007 1:51 am
Reply with quote

Dang, that SYMNAMES is neat......
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jun 16, 2007 5:24 am
Reply with quote

Glad you like it. icon_cool.gif
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Sat Jun 16, 2007 9:33 am
Reply with quote

Frank,

When was this SYMNAMES introduced?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jun 16, 2007 9:43 pm
Reply with quote

Quote:
When was this SYMNAMES introduced?


Way back in Sept, 1998.

You can look up when any DFSORT function was first available in my paper at:

www.ibm.com/servers/storage/support/software/sort/mvs/summary_changes/srtmsocc.html
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top