Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Format data from one file to another using sort.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Wed Aug 27, 2008 12:52 pm    Post subject: Format data from one file to another using sort.
Reply with quote

Hi,

Please can anyone help me out with the following.

I have following File1 as

Code:

01  FILE1-VARS.                   
  05 FILE1-TRANS-TYPE                      PIC X(01)
  05 FILE1-SOURCE                 PIC X(01)
  05 FILE1-BATCH                   PIC X(14)
  05 FILE1-DCN                       PIC X(18)
  05 FILE1-FILL                        PIC X(66)


and File2 as

Code:

01  FILE2-VARS.
  05  FILE2-DCN                    PIC X(18) 
  05  FILE2-BATCH                  PIC X(14)
  05  FILE2-SCAN-DATE              PIC X(06)
  05  FILE2-SCAN-TIME              PIC X(06)
  05  FILE2-RECV-DATE              PIC X(06)
  05  FILE2-RECV-TIME              PIC X(06)
  05  FILE2-OTH-ATTACH-IND        PIC X(01)
  05  FILE2-FORM-TYPE   PIC X(03)
  05  FILE2-SOURCE-GROUP-ID   PIC X(07)
  05  FILLER                               PIC X(33) 


Using outrec I would like to move the variables from File1 to File2 as follows:

FILE1-DCN3 -----> FILE2-DCN
FILE1-BATCH3 -----> FILE2-BATCH
spaces -----> FILE2-SCAN-DATE
spaces -----> FILE2-SCAN-TIME
spaces -----> FILE2-RECV-DATE
spaces -----> FILE2-RECV-TIME
spaces -----> FILE2-OTH-ATTACH-IN
‘BAD‘ -----> FILE2-FORM-TYPE
‘N/A ‘ -----> FILE2-SOURCE-GROUP-ID


Thanks,
Muffazel
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2275
Location: @my desk

PostPosted: Wed Aug 27, 2008 7:15 pm    Post subject:
Reply with quote

Muffazel,

Try this SORT card.
Code:
  INREC BUILD=(17,18,3,14,25X,'BADN/A',37X)
  OPTION COPY


Thanks,
Arun
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Aug 27, 2008 10:29 pm    Post subject:
Reply with quote

Muffazel,

It's not clear what you want to do. You say you want to move the variables from file1 to file2. Do each of these files only have one record, or do they have more than one record. Do you want to move fields from record 1 of file1 to record 1 of file2, fields from record 2 of file1 to record 2 of file2, etc? Or do you want to move fields between the records of the two files in some other way? How?

Quote:

FILE1-DCN3 -----> FILE2-DCN
FILE1-BATCH3 -----> FILE2-BATCH


I see a FILE1-DCN field, but not a FILE1-DCN3 field. What is FILE1-DCN3?
I see a FILE1-BATCH field, but not a FILE1-BATCH3 field. What is FILE1-BATCH3?

Please show an example of the records in each input file and what you expect for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input files.

Arun,

I don't know what you're doing with the INREC statement you show, but whatever it is, it only operates on file, not two files as requested.
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Wed Aug 27, 2008 11:24 pm    Post subject: Reply to: Format data from one file to another using sort.
Reply with quote

Hi,

I am sorry it was a typo.
Following is the corrected version

Move FILE1-DCN -----> FILE2-DCN
Move FILE1-BATCH -----> FILE2-BATCH
Move spaces -----> FILE2-SCAN-DATE
Move spaces -----> FILE2-SCAN-TIME
Move spaces -----> FILE2-RECV-DATE
Move spaces -----> FILE2-RECV-TIME
Move spaces -----> FILE2-OTH-ATTACH-IN
Move ‘BAD‘ -----> FILE2-FORM-TYPE
Move ‘N/A ‘ -----> FILE2-SOURCE-GROUP-ID

Actually I have to move records from File1 to File2 and there can be more than one record in File1.
Both the files are FB.

LRECL

File1 - 200
File2 - 100

I hope I am clear.

Thanks,
Muffazel Madda
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Aug 28, 2008 1:04 am    Post subject:
Reply with quote

Quote:
I hope I am clear.


No, you're not.

Quote:
Actually I have to move records from File1 to File2 and there can be more than one record in File1.


Again, how do you want to match up the records in file1 with the records in file2? One at a time (file1 record 1 with file2 record1, file1 record 2 with file2 record2? By a key in the two records (what key)? Some other way?

Please go back and read my first post and answer ALL of my questions, show the requested example of input and output records, and explain the "rules" for "move records from File1 to File2".

I'm willing to help, but I can't read your mind.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2275
Location: @my desk

PostPosted: Thu Aug 28, 2008 10:08 am    Post subject:
Reply with quote

Frank,
Quote:
Arun,
I don't know what you're doing with the INREC statement you show, but whatever it is, it only operates on file, not two files as requested.

I m not sure if I have really misunderstood the OPs requirement. But from whatever he has posted, it seems like he just want to copy records from input to output ;but with a change in the layout.

Quote:
Again, how do you want to match up the records in file1 with the records in file2?

Muffazel said he just want to move records from file1 to file2. He has not mentioned anything about file-matching.

Muffazel,
Can you try this JCL. If this does not satisfy your requirement, you need to explain the rules in detail as Frank suggested.
Code:
//STEP1    EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD DSN=file1......> FB/LRECL=200   
//SORTOUT  DD DSN=file2......> FB/LRECL=100   
//SYSIN    DD *                               
   INREC BUILD=(17,18,3,14,25X,C'BADN/A',100:X)
   OPTION COPY 


Thanks,
Arun
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Aug 28, 2008 9:13 pm    Post subject:
Reply with quote

Arun,

So you're saying that File1 here is the input and File2 is the output?

I assumed that when the OP said I have File1 and File2, he meant that these files already existed so he wanted to combine them in some way. But perhaps you're right that he really meant he has File1 and wants to create File2 from it. Sometimes the words people use can be quite misleading.

Confusing things more, you showed him a solution based on that assumption earlier and he didn't come back and say "yes, that's what I need".
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us