Migrating objects - Unix to Linux

Hi,

I am supporting my co-worker on Natural migration from Unix to Linux, and one of the tasks is to transfer the objects from one site to other. One option would be to use IMPORT function; however, it seems this procedure needs to inform whether the object is in report mode or structured mode. As I have many of them, and they are developed mixing report and structured, I don’t have any option to leave the object as the origin.

So, is there a way to solve it, or do I need to transfer using SYSTRANS or SYSOBJH? Would be great if it is possible to use IMPORT function? Is there any trick to use SYSOBJH handling many libraries or not on Unix? My experience is on MF.

tks.

I recommend Object Handler.

To unload a specific library

UNLOAD * LIB libname OBJTYPE N

To unload all libraries

UNLOAD * LIB * OBJTYPE N

To load into an identical directory structure:

LOAD *

To include DDMs use OBJTYPE D.

My experience with a Linux target is limited, but I don’t recall any difficulties.

Hi Ralph,

thank you for your information. I have tested using SYSOBJH online and it works. now, as Linux is not my expertise as well, I am trying to do it in batch mode, because I have many libraries to transfer. Using SYSOBJH command, as you are suggesting and I also am trying to do it, it seems that I need to execute the object OBJHCMD before, however, it is a little different than MF on batchmode.

The idea is to create a program that would read a sequencial file where the libraries are included, and then for each library I would build the command to transfer. So, if anyone knows how to create this procedure, I would appreciate it a lot, because I will spend a lot time testing.

tks

I don’t have a Linux script to offer you, but here’s the Windows equivalent.

@echo off
SETLOCAL
SET PATH=%PATH%;C:\Program Files\Software AG\Natural\6.3\Bin

SET NATFILE=ObjH

echo sysobjh                        >%NATFILE%.inc
echo unload s* lib jcl  objtype n  >>%NATFILE%.inc
echo unload *  lib junk objtype n  >>%NATFILE%.inc
echo FIN                           >>%NATFILE%.inc

@echo on

natural batchmode parm=NATBATCH CMSYNIN=%NATFILE%.inc CMOBJIN=%NATFILE%.inc CMPRINT=%NATFILE%.out CMPRT01=%NATFILE%.txt NATLOG=ALL BMSIM=MF
rem config file: CMWKF01=%natfile%.sag CMWKF04=%natfile%.prt 

@echo off
If ERRORLEVEL 1 GOTO :NATERROR
goto :EXIT

:NATERROR
echo Error from Natural Step, check %NATFILE%.OUT for details
pause

:EXIT
del %NATFILE%.inc
rem del %NATFILE%.out
rem del %NATFILE%.txt

ENDLOCAL

exit

You must define Work 1 (unloaded objects) and Work 4 (optional report) in your NatParms via the Natural Configuration Utility.

For this test, I generate the ObjH parameters in-stream using ECHO commands. You’ll provide .INC as a separate file.

Your proposal to read and edit a list of library names seems overly complicated to me. Is the list created manually or computer-generated? Is it very dynamic? Is it very large but not a complete set? Wouldn’t wildcards help? (eg LIB * or LIB rgz*)

This may be a bit more than you wanted, but give this script a try

#!/bin/bash
# arguments - 
# $1 library name
# $2 fuser dbid
# $3 fuser fnr
# to use:
# scriptname libary fuser_dbid fuser_fnr
# 
# this will create a sysobjh transfer file in the current directory, along
# with a report and object list (workfiles 4 and 3)
# 
# assumed: natparm points workfiles to $NATWK01 - $NATWKNN
export filename=`date +"$1.fuser_$2_$3.cmsynin.%Y%m%d.%H%M%S.$$.txt"`
export NATWK01=`pwd`'/'`date +"$1.fuser_$2_$3.transferfile.%Y%m%d.%H%M%S.$$.txt"`
export NATWK02=`pwd`'/'NATWK02.txt
export NATWK03=`pwd`'/'`date +"$1.fuser_$2_$3.wrfk03.%Y%m%d.%H%M%S.$$.txt"`
export NATWK04=`pwd`'/'`date +"$1.fuser_$2_$3.report.%Y%m%d.%H%M%S.$$.txt"`
export NATWK05=`pwd`'/'NATWK05.txt
echo 'logon system' > $filename
echo 'sysobjh' >> $filename
echo 'UNLOAD * LIB '$1' DBID '$2' FNR '$3' OBJTYPE NE NATTYPE PNSHC8M347TGLA SCKIND S WHERE REPORT $NATWK04 TRANSFER WORKFILE $NATWK01 WORKFILETYPE D' >> $filename
echo '.' >> $filename
export cmprint=`date +"$1.fuser_$2_$3.cmprint.%Y%m%d.%H%M%S.$$.txt"`
export cmprt01=`date +"$1.fuser_$2_$3.cmprt01.%Y%m%d.%H%M%S.$$.txt"`
export cmsynin=$filename
cat $filename
natural batchmode fuser=$2,$3 CMPRINT=$cmprint CMPRT01=$cmprt01 CMSYNIN=$cmsynin CMOBJIN=$cmsynin
ret=$?
if [ "$ret"=="0" ]; then
  echo "Created " $NATWK01
  exit 0
else
  echo "SYSOBJH failed to create transfer file, check " $cmprint " for further details"
  exit $ret
fi

We got a related topic here (with script inside):

if “THE objects” means all of them you should be able to just copy the whole FUSER directory across.

As soon as you move just a subset you’ll have to use SYSOBJH, unless you have NDV servers
set up on both sides which would allow you to just DnD it from Natural Windows / Natural Studio.

Hi Ralph, James, Mathias and Wolfgang,

Thank you very much for the information and script, I appreciated a lot.

Unfortunately, I cannot copy the entire fuser, because the customer wants to take advantage to the moment to clean up the environment. So, there are some libraries that need to be copied and other not.

Again, thank you all.

tks.

Hi John,

You don’t have to copy the complete FUSER to the new Linux box. You can just copy the directories for the libraries that you want there .

Cheers,

Graeme Lane